I have server A and server B and can ssh from server A to server B if I’m logged in as the user whose keys have been set up
But,I can’t do user@serverB from server A logged in as another user
and I can’t do the following to allow the user to ssh to the local server
- -bash-4.2$ ssh-copy-id jenkins@localhost
- /bin/ssh-copy-id: INFO: attempting to log in with the new key(s),to filter out any that are already installed
- /bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
- Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
Check if “PasswordAuthentication” is set to “no” in /etc/ssh/sshd_config on the remote system if so,then change it to “yes” and restart sshd service and then check. By default this is set to “yes”.
- [root@ansible-host ~]# grep ^PasswordAuthentication /etc/ssh/sshd_config
- PasswordAuthentication yes
重启sshd服务器
- sudo systemctl restart sshd