linux ssh远程登录提示账户密码不对,CentOS 7 root账号ssh登入时密码验证失败

新装系统root用户密码ssh无法登入,pubkey验证ssh登入OK,虽然不影响使用,只是比较纳闷为什么会这样。

背景情况:

1、新安装一台CentOS 7,没有下载最新的镜像文件,用的这个:CentOS-7.0-1406-x86_64-livecd.iso;

2、安装过程中没有创建其它用户,装好后root账号无法登入,有点纳闷,只好认为自己安装时输入两遍的密码记错了;

3、参考这里的方法重设了root密码:

http://www.tejasbarot.com/2014/08/06/rhel-7-centos-7-recovering-root-password/

此时本地登入OK,启动SSH服务,root远程SSH用密码方式无法登入,现象同密码输入错误,即输入账号、密码后,提示“Access Denied”。

/var/log/secure中ssh登入时看到的相关log如下(只是更改hostname、rhost、IP等信息):

May 27 08:38:03 MYHOST unix_chkpwd[6385]: password check failed for user (root)

May 27 08:38:03 MYHOST sshd[6383]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=xxx.xxx.xxx  user=root

May 27 08:38:03 MYHOST sshd[6383]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"

May 27 08:38:05 MYHOST sshd[6383]: Failed password for root from 172.28.xxx.xxx port 1511 ssh2

因为是新系统,并没有更改过sshd配置限制root登入,不过我还是确认了下,默认配置是这样:

# Authentication:

#LoginGraceTime 2m

#PermitRootLogin yes

#StrictModes yes

#MaxAuthTries 6

#MaxSessions 10

#RSAAuthentication yes

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2

# but this is overridden so installations will only check .ssh/authorized_keys

AuthorizedKeysFile      .ssh/authorized_keys

还有密码验证也是yes:

PasswordAuthentication yes

我也试过将PermitRootLogin前面的#删掉,root同样无法登入,新建一个普通用户后,用此用户可以SSH密码方式登入,不过登入后 su - 切换root同样提示密码不对。

我也没有调整过系统的pam相关验证配置,搞不清楚怎么回事;

也尝试过将SElinux改为Permissive,状况一样。

目前是将新建用户加入wheel组,看了sudo默认配置wheel组可以执行所有命令;

同时将新建的普通用户和root都配置了pubkey方式登入,这样我还好,不过其他一些同事一直习惯用密码方式,所以密码无法登入的问题还是想查清楚。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值