Skip to main content

常见错误

Authentication refused

进入日志文件 cat /var/log/secure

错误信息

Authentication refused:
Nov 14 22:09:12 VM-0-15-centos sshd[392]: Authentication refused: bad ownership or modes for file /home/hongqi/.ssh/authorized_keys
Nov 14 22:09:16 VM-0-15-centos sshd[392]: Accepted password for hongqi from 116.199.103.214 port 33965 ssh2
Nov 14 22:09:16 VM-0-15-centos sshd[392]: pam_unix(sshd:session): session opened for user hongqi by (uid=0)
Nov 14 22:09:18 VM-0-15-centos sshd[400]: Received disconnect from 116.199.103.214 port 33965:11: disconnected by user
Nov 14 22:09:18 VM-0-15-centos sshd[400]: Disconnected from 116.199.103.214 port 33965
Nov 14 22:09:18 VM-0-15-centos sshd[392]: pam_unix(sshd:session): session closed for user hongqi
Nov 14 22:09:19 VM-0-15-centos sshd[449]: Authentication refused: bad ownership or modes for file /home/hongqi/.ssh/authorized_keys
Nov 14 22:09:22 VM-0-15-centos sshd[449]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=116.199.103.214 user=hongqi
Nov 14 22:09:24 VM-0-15-centos sshd[449]: Failed password for hongqi from 116.199.103.214 port 31551 ssh2

原因

  • 因为SSH不希望home目录和~/.ssh目录对组有写权限

解决方案1

# 重新检查home和.ssh的目录权限
chmod 700 .ssh 
chmod 600 .ssh/authorized_keys

参考资料:https://blog.csdn.net/lisongjia123/article/details/78513244

Host key verification failed.

错误信息

PS C:\Users\Administrator> ssh -p 4523 root@49.234.229.193
The authenticity of host '[49.234.229.193]:4523 ([49.234.229.193]:4523)' can't be established.
ED25519 key fingerprint is SHA256:KEULRdyxu90KsDC0uv7AI6l4a9K/KQke2krLH1Yh0iE.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])?

错误原因

这里不能使用Enter跳过,需要明确输入"yes",再输入密码才可以进行登陆