I am root in a system. There seems to be a passwordless user in this system I try becoming a different specific user by using "su - username", and get a "Password" prompt. No matter if I enter a password, or not enter a password and just press enter, I still become that user. Why is this?

  • maybe you're hacked. please give more detail (eg: a transcript) – Jasen Sep 23 '16 at 5:41

Normally root doesn't get a password prompt at all. Linux's su doesn't support passwordless accounts; login allows any password if the account is passwordless.

The behavior you describe sounds like a bad PAM configuration, perhaps lines in the wrong order. Check your PAM configuration: /etc/pam.conf, /etc/pam.d/su and any included file. The important lines are the auth lines.

A typical basic configuration for su is

auth sufficient pam_rootok.so
auth required pam_unix.so

I don't know what the default setup is on CentOS, it might be more complex to allow LDAP authentication, Kerberos, home directory automount, etc. If you need help understanding it, post your PAM configuration (at least every auth line that applies to su, in the right order).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.