[Linux] SSH配置了免密碼登入,登入時還要輸入密碼
Linux SSH配置了免密碼登入,登入時還要輸入密碼
[mon@oracle6 ~]$ ll .ssh
ls: cannot access .ssh: No such file or directory
[mon@oracle6 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/mon/.ssh/id_rsa):
Created directory '/home/mon/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/mon/.ssh/id_rsa.
Your public key has been saved in /home/mon/.ssh/id_rsa.pub.
The key fingerprint is:
5c:0e:06:09:64:aa:ae:47:1d:9e:11:e9:58:d8:9c:36 mon@oracle6
The key's randomart image is:
+--[ RSA 2048]----+
| =++.. |
| .oE .. |
| .= o o . |
| .. + o + |
|. o + S . |
|. . + |
| o |
|. . |
|.. |
+-----------------+
[mon@oracle6 ~]$ ll .ssh
total 12
-rw-------. 1 mon mon 1675 Feb 21 17:16 id_rsa
-rw-r--r--. 1 mon mon 393 Feb 21 17:16 id_rsa.pub
-rw-r--r--. 1 mon mon 401 Feb 21 17:17 known_hosts
[mon@oracle6 ~]$ ssh mon@topaz "cat >> ~/.ssh/authorized_keys" < ~/.ssh/id_rsa.pub
The authenticity of host 'oracle (172.16.99.19)' can't be established.
RSA key fingerprint is b6:9f:be:8a:ad:1e:e8:c8:1f:b4:75:04:01:69:0e:5e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'oracle,172.16.99.19' (RSA) to the list of known hosts.
mon@topaz's password: mon
[mon@oracle6 ~]$ ssh mon@topaz
mon@topaz's password:
ssh mon@topaz還需要輸入密碼。
baidu之後發現topaz伺服器上,的authorized_keys屬性(664)有問題,應該為600
authorized_keys的正確屬性為600
.ssh的正確屬性為700
[mon@topaz ~]$ ll -a
drwx------ 2 mon mon 4096 Feb 21 19:13 .ssh
[mon@topaz .ssh]$ ll
total 12
-rw-rw-r-- 1 mon mon 1179 Feb 21 19:16 authorized_keys
-rw------- 1 mon mon 1675 Feb 21 19:12 id_rsa
-rw-r--r-- 1 mon mon 391 Feb 21 19:12 id_rsa.pub
修改authorized_keys的屬性為600
[mon@topaz .ssh]$ chmod 600 authorized_keys
之後ssh mon@topaz可以正常登入。
[mon@oracle6 ~]$ ssh mon@topaz
Last login: Sun Feb 21 19:17:49 2016 from s-file-backend.domain.com
[mon@oracle6 ~]$ echo "df -P" | ssh mon@topaz
Pseudo-terminal will not be allocated because stdin is not a terminal.
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/sda2 14877092 5685340 8423848 41% /
/dev/sda5 62216440 52317664 6687388 89% /u01
/dev/sda1 101086 11885 83982 13% /boot
tmpfs 4194304 1063292 3131012 26% /dev/shm
/dev/sdc1 82567188 705556 77667464 1% /u02
[mon@oracle6 ~]$ ll .ssh
ls: cannot access .ssh: No such file or directory
[mon@oracle6 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/mon/.ssh/id_rsa):
Created directory '/home/mon/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/mon/.ssh/id_rsa.
Your public key has been saved in /home/mon/.ssh/id_rsa.pub.
The key fingerprint is:
5c:0e:06:09:64:aa:ae:47:1d:9e:11:e9:58:d8:9c:36 mon@oracle6
The key's randomart image is:
+--[ RSA 2048]----+
| =++.. |
| .oE .. |
| .= o o . |
| .. + o + |
|. o + S . |
|. . + |
| o |
|. . |
|.. |
+-----------------+
[mon@oracle6 ~]$ ll .ssh
total 12
-rw-------. 1 mon mon 1675 Feb 21 17:16 id_rsa
-rw-r--r--. 1 mon mon 393 Feb 21 17:16 id_rsa.pub
-rw-r--r--. 1 mon mon 401 Feb 21 17:17 known_hosts
[mon@oracle6 ~]$ ssh mon@topaz "cat >> ~/.ssh/authorized_keys" < ~/.ssh/id_rsa.pub
The authenticity of host 'oracle (172.16.99.19)' can't be established.
RSA key fingerprint is b6:9f:be:8a:ad:1e:e8:c8:1f:b4:75:04:01:69:0e:5e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'oracle,172.16.99.19' (RSA) to the list of known hosts.
mon@topaz's password: mon
[mon@oracle6 ~]$ ssh mon@topaz
mon@topaz's password:
ssh mon@topaz還需要輸入密碼。
baidu之後發現topaz伺服器上,的authorized_keys屬性(664)有問題,應該為600
authorized_keys的正確屬性為600
.ssh的正確屬性為700
[mon@topaz ~]$ ll -a
drwx------ 2 mon mon 4096 Feb 21 19:13 .ssh
[mon@topaz .ssh]$ ll
total 12
-rw-rw-r-- 1 mon mon 1179 Feb 21 19:16 authorized_keys
-rw------- 1 mon mon 1675 Feb 21 19:12 id_rsa
-rw-r--r-- 1 mon mon 391 Feb 21 19:12 id_rsa.pub
修改authorized_keys的屬性為600
[mon@topaz .ssh]$ chmod 600 authorized_keys
之後ssh mon@topaz可以正常登入。
[mon@oracle6 ~]$ ssh mon@topaz
Last login: Sun Feb 21 19:17:49 2016 from s-file-backend.domain.com
[mon@oracle6 ~]$ echo "df -P" | ssh mon@topaz
Pseudo-terminal will not be allocated because stdin is not a terminal.
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/sda2 14877092 5685340 8423848 41% /
/dev/sda5 62216440 52317664 6687388 89% /u01
/dev/sda1 101086 11885 83982 13% /boot
tmpfs 4194304 1063292 3131012 26% /dev/shm
/dev/sdc1 82567188 705556 77667464 1% /u02
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-1994776/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux 配置 SSH 秘鑰免密碼登入Linux密碼
- SSH配置—Linux下實現免密碼登入Linux密碼
- Linux配置SSH免密碼登入(非root賬號)Linux密碼
- ssh免密登入
- Windows配置ssh免密登入linux+VSCode Remote-SSH免密編寫linux程式碼WindowsLinuxVSCodeREM
- hadoop-SSH免密登入配置Hadoop
- linux 設定ssh 免密登入Linux
- ssh免密登入原理
- ssh免密碼登入失敗解決密碼
- ssh直接帶密碼登入Linux,Linux自動密碼登陸利器sshpass密碼Linux
- Linux密碼策略和登入配置Linux密碼
- Linux - 配置SSH免密登入 - “ssh-keygen”的基本用法Linux
- Linux 免密登入Linux
- centos7 設定ssh免密碼登入配置方法CentOS密碼
- ssh進階,免密登入
- SSH免密登入詳解
- unbuntu16.04 伺服器的 免密登入、秘鑰登入和禁止密碼登入 配置伺服器密碼
- unbuntu16.04 伺服器的 免密登入、祕鑰登入和禁止密碼登入 配置伺服器密碼
- 配置SSH免密碼登陸密碼
- 密碼登入密碼
- AWS EC2 Linux | ssh 使用密碼登入Linux密碼
- ssh免密登入簡單操作
- CentOS監控ssh免密登入CentOS
- 在CentOS/RHEL上設定SSH免密碼登入CentOS密碼
- GitHub不再支援密碼驗證解決方案:SSH免密與Token登入配置Github密碼
- SSH 遠端登入「記住密碼」密碼
- 直播app原始碼,登入時自動輸入密碼/自動記住密碼APP原始碼密碼
- 1-Linux叢集搭建,分發指令碼,ssh免密登入Linux指令碼
- SSH免密登入+JDK安裝配置+Hadoop安裝配置JDKHadoop
- macbook開機登入時輸入正確的密碼卻提示密碼錯誤Mac密碼
- 一對一視訊原始碼,登入時輸入密碼時的顯示密碼按鈕原始碼密碼
- git免密登入Git
- uniapp 完成兩種方式登入 驗證碼登入 密碼登入APP密碼
- 修改 MySQL 登入密碼MySql密碼
- 密碼方式登入redis密碼Redis
- ssh-copy-id登陸無需重複輸入密碼密碼
- VS Code / Pycharm配置SSH遠端開發(免密登入)PyCharm
- Linux配置SSH免密登陸(公私鑰登陸)Linux
- linux破解root登入密碼,並重置Linux密碼