我无法通过密码登录我的服务器,即使我通过 明确设置了用户的密码usermod
。我已PasswordAuthentication yes
在我的 中设置sshd_config
并重新启动了 ssh 守护程序。我甚至多次设置了用户的密码。但是,当我尝试登录我的服务器时,sshd 显示以下日志输出:
Jan 24 21:18:31 ip-10-36-13-72 sshd[11756]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=173.12.2.64 user=jimuser
Jan 24 21:18:34 ip-10-36-13-72 sshd[11756]: Failed password for jimuser from 173.12.2.64 port 15508 ssh2
目前我还不太清楚该去哪里找。有什么想法吗?
更新:
/etc/pam.d/sshd
#%PAM-1.0
auth required pam_sepermit.so
auth include password-auth
account required pam_nologin.so
account include password-auth
password include password-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open env_params
session optional pam_keyinit.so force revoke
session include password-auth
/etc/pam.d/system-auth
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth required pam_env.so
auth sufficient pam_unix.so try_first_pass nullok
auth required pam_deny.so
account required pam_unix.so
password requisite pam_cracklib.so try_first_pass retry=3 type=
password sufficient pam_unix.so try_first_pass use_authtok nullok sha512 shadow
password required pam_deny.so
session optional pam_keyinit.so revoke
session required pam_limits.so
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so
答案1
首先要尝试使用 passwd 命令设置用户密码
# passwd jimuser
Changing password for user jimuser.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
如果这有效,那么一切都很好,但请注意,usermod 采用预先加密的密码字符串
-p, --password PASSWORD 加密密码,由 crypt(3) 返回。
如果你确实想提供预先加密的密码,那么有多种工具可供选择,例如sha1pass(perl 脚本)grub-墓穴(python)或者看看解决方案这里。