Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM