[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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- centos配置ssh免密碼登入後,仍提示輸入密碼CentOS密碼
- SSH免密碼登入密碼
- 配置雙機ssh免密碼登入密碼
- Linux 配置 SSH 秘鑰免密碼登入Linux密碼
- SSH配置—Linux下實現免密碼登入Linux密碼
- Mac 下 SSH 免密碼登入Mac密碼
- ssh公鑰免密碼登入密碼
- SSH認證免密碼登入密碼
- linux ssh公鑰免密碼登入Linux密碼
- Linux配置SSH免密碼登入(非root賬號)Linux密碼
- [RHEL7] ssh免密碼登入密碼
- centos ssh免密碼秘鑰登入CentOS密碼
- Linux SSH無密碼登入Linux密碼
- ssh免密登入原理
- Hadoop過程中配置SSH免密碼登入Hadoop密碼
- linux中ssh使用rsa免密碼登入方法Linux密碼
- Linux下配置ssh免密遠端登入Linux
- ssh免密碼登入失敗解決密碼
- [轉] ssh免密碼登入伺服器密碼伺服器
- hadoop-SSH免密登入配置Hadoop
- linux 設定ssh 免密登入Linux
- centos7 設定ssh免密碼登入配置方法CentOS密碼
- SSH免密登入詳解
- SSH 實現免密登入
- ssh進階,免密登入
- ssh免認證配置後還是提示輸入密碼密碼
- 配置SSH免密碼登陸密碼
- Windows配置ssh免密登入linux+VSCode Remote-SSH免密編寫linux程式碼WindowsLinuxVSCodeREM
- linux A機器ssh登入B機器無需輸入密碼Linux密碼
- unbuntu16.04 伺服器的 免密登入、祕鑰登入和禁止密碼登入 配置伺服器密碼
- unbuntu16.04 伺服器的 免密登入、秘鑰登入和禁止密碼登入 配置伺服器密碼
- 密碼登入密碼
- Linux 免密登入Linux
- Linux密碼策略和登入配置Linux密碼
- ssh免密登入簡單操作
- 使用SSH RSA key免密碼登入Linux伺服器密碼Linux伺服器
- ssh直接帶密碼登入Linux,Linux自動密碼登陸利器sshpass密碼Linux
- 在CentOS/RHEL上設定SSH免密碼登入CentOS密碼