0

I'm having trouble logging into my server via a password, even when I explicitly set the user's password via usermod. I've set PasswordAuthentication yes in my sshd_config and restarted the ssh daemon. I've even set the user's password multiple times. However when I try to login to my server, sshd shows the following log output:

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

At this point I'm not really sure where to look. Any ideas?

UPDATE:

/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
Justin Meltzer
  • 621
  • 1
  • 9
  • 18

1 Answers1

0

The first thing to do is to try setting the password for the user using the passwd command

# passwd jimuser
Changing password for user jimuser.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

If this works then all well and good but note that usermod takes a pre encrypted password string

-p, --password PASSWORD The encrypted password, as returned by crypt(3).

If you really do want to supply pre encrypted passwords then there are a variety of tools e.g. sha1pass (a perl script) grub-crypt (python) or take a look at the solutions here.

user9517
  • 114,104
  • 20
  • 206
  • 289