問題現象密碼輸入正确無法發送過去密鑰
[root@localhost .ssh]# ssh-copy-id -i id_rsa.pub " -p 22 [email protected]"
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
-p 22 [email protected]'s password:
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
着一切的禍根都是.ssh的權限問題
[root@localhost .ssh]# ssh-copy-id -i id_rsa.pub "[email protected]"
[email protected]'s password:
sh: .ssh/authorized_keys: 權限不夠
随後把.ssh的權限改為700就好了
chmod 700 .ssh
[root@localhost .ssh]# ssh-copy-id -i id_rsa.pub "[email protected]"
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.