成功创建密钥并ssh-copy-id
成功使用命令后,我可以通过ssh user@host
但当我尝试通过 rsync 进行传输时,它会要求输入密码...... rsync 命令如下:
rsync -av -e "ssh -o PubkeyAuthentication=yes -o PasswordAuthentication=no -X user@hostname" /home/Compart user@hostname:/home/user/backup/
我已经尝试过了:
rsync -av --rsh="ssh -l user" /home/Compart user@hostname:/home/user/backup/
rsync -av -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" /home/Compart user@hostname:/home/user/backup/
仍然没有任何反应...总是要求输入密码...
#tail -f /var/log/auth.log
Oct 27 11:48:42 hostname sshd[15531]: Accepted password for user from 10.14.6.93 port 41893 ssh2
Oct 27 11:48:42 hostname sshd[15531]: pam_group(sshd:setcred): bad group: powerdev
Oct 27 11:48:42 hostname sshd[15531]: pam_group(sshd:setcred): bad group: libvirt
Oct 27 11:48:42 hostname sshd[15531]: pam_group(sshd:setcred): bad group: kvm
Oct 27 11:48:42 hostname sshd[15531]: pam_group(sshd:setcred): bad group: sane
Oct 27 11:48:42 hostname sshd[15531]: pam_unix(sshd:session): session opened for user user by (uid=0)
Oct 27 11:48:42 hostname systemd-logind[879]: New session 39 of user user.
Oct 27 11:48:42 hostname sshd[15615]: pam_group(sshd:setcred): bad group: powerdev
Oct 27 11:48:42 hostname sshd[15615]: pam_group(sshd:setcred): bad group: libvirt
Oct 27 11:48:42 hostname sshd[15615]: pam_group(sshd:setcred): bad group: kvm
Oct 27 11:48:42 hostname sshd[15615]: pam_group(sshd:setcred): bad group: sane
Oct 27 11:48:42 hostname sshd[15615]: Received disconnect from 10.14.6.93: 11: disconnected by user
Oct 27 11:48:42 hostname sshd[15531]: pam_unix(sshd:session): session closed for user user
Oct 27 11:48:54 hostname systemd-logind[879]: Removed session 39.
其中 10.14.6.93 是文件当前所在机器,也是执行 rsync 的地方......
有任何想法吗?
答案1
.ssh/config
以下命令使用我的公钥,并且不要求输入密码,尽管我拥有远程主机的有效密码和有效公钥。另外,为了安全起见,请确保您没有设置密码。
rsync -av /home/user user@hostname:/home/user/backup