sftp -b batchfile username@remote_host
報錯:Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)
因為SSH不能訪問你的authorized_keys,所以必需先認證然后才能訪問
remote_host,root登陸
# mkdir /etc/ssh/<username>
# cp /home/<username>/.ssh/authorized_keys /etc/ssh/<username>/
# chmod 755 /etc/ssh/<username>
# chmod 600 /etc/ssh/<username>/authorized_keys
# chown -R username:username /etc/ssh/<username>
3. 編輯配置文件/etc/ssh/sshd_config並添加下列內容
# vi /etc/ssh/sshd_config
AuthorizedKeysFile /etc/ssh/%u/authorized_keys
4. 重啟SSH
# /etc/init.d/sshd restart