SSH登陆Linux常见问题大全
环境
centos 7 minimal
Root登陆被禁止
问题描述
首次使用ssh登陆一个刚装的Centos minimal版系统时,使用root账户登陆连续提示:权限被拒绝,请再次输入密码
异常提示:
$ ssh root@192.168.20.130
root@192.168.20.130's password:
Permission denied, please try again.
root@192.168.20.130's password:
Permission denied, please try again.
root@192.168.20.130's password:
问题原因可能是:root登陆被禁止
解决方法
修改配置文件sshd_config,文件路径/etc/ssh/sshd_config
修改PermitRootLogin参数为yes,并去掉注释符#,如下:
PermitRootLogin yes #允许使用ssh进行root登陆
以密码登陆账户被禁止
问题描述
使用密码登陆被拒绝访问并提示:“权限被拒绝”错误,提示可用公钥登陆
异常提示:
$ ssh root@192.168.20.10
root@192.168.20.10: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
问题原因可能是:sshd禁止了使用密码来登陆该系统,但可用公钥验证身份。
解决方法
修改配置文件sshd_config,文件路径/etc/ssh/sshd_config
修改PasswordAuthentication参数为yes,并去掉注释符#,如下:
# To disable tunneled clear text passwords, change to no here!PasswordAuthentication yes #允许ssh使用密码验证账户
保存配置并返回到系统视图下执行
service sshd restart #重启sshd服务使配置生效
The end.