我一直在尝试使用无密码技术登录到centos 7。
首先,我生成了一个公共密钥:
ssh-keygen
然后尝试将按键与远程连接:
➜ ~ ssh-copy-id user@xxx.com
/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
user@xxx.com's password:
Number of key(s) added: 1
Now try logging into the machine, with "ssh 'user@xxx.com'"
and check to make sure that only the key(s) you wanted were added.
后来我尝试连接到远程但收到密码提示:
➜ ~ ssh 'user@xxx.com'
user@xxx.com's password:
此外,我尝试对root用户执行相同操作,并且对于root用户,此技术有效