- 工信部备案号 滇ICP备05000110号-1
- 滇公安备案 滇53010302000111
- 增值电信业务经营许可证 B1.B2-20181647、滇B1.B2-20190004
- 云南互联网协会理事单位
- 安全联盟认证网站身份V标记
- 域名注册服务机构许可:滇D3-20230001
- 代理域名注册服务机构:新网数码
通过SSH客户端登录Linux实例时提示“Permission denied, please try again”错误怎么办?
问题描述
过本地SSH客户端登录Linux系统的ECS实例时,即便输入了正确的密码,出现了类似如下的错误信息。
Permission denied, please try again.
SSH服务器拒绝了密码,请再试一次。
问题原因
导致该问题可能有以下原因:
ECS实例内禁用root用户登录:SSH服务对应配置文件/etc/ssh/sshd_config中的参数PermitRootLogin或PasswordAuthentication被设置为no。您可以参考禁止root用户登录引起问题的解决方法解决。
PermitRootLogin设置为no,表示禁用使用root用户登录。
PasswordAuthentication设置为no,表示禁用使用密码方式登录,但是可以使用密钥方式登录。
Linux系统启用了SELinux服务,导致root用户和普通用户无法登录。
执行cat /var/log/secure查看secure日志,若日志中包含error: Could not get shadow infromation for root.表示是启用了SELinux服务导致
禁止root用户登录引起问题的解决方法
以VNC方式登录服务器
查看/etc/ssh/sshd_config的参数PermitRootLogin或PasswordAuthentication配置。
· cat /etc/ssh/sshd_config
如下图所示,PermitRootLogin和PasswordAuthentication参数设置为no,表示禁止root用户登录,也禁止以密码方式登录。
根据业务需要,修改PermitRootLogin和PasswordAuthentication参数配置
vi /etc/ssh/sshd_config
# 如果需要root用户登录,请将PermitRootLogin参数值设置为yes
# 如果需要密码方式登录,请将PasswordAuthentication参数值设置为yes。
# 更改后保存退出
执行如下命令,重启SSH服务。
SELinux服务引起问题的解决方法
以VNC方式登录服务器
执行如下命令,查看当前SELinux服务状态。
/usr/sbin/sestatus -v
# 系统显示类似如下
SELinux status: enabled
临时关闭SELinux服务
执行setenforce 0
永久关闭SELinux
执行sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
售前咨询
售后咨询
备案咨询
二维码
TOP