How to Fix ‘su: Authentication failure’ in Linux

Transitioning between Linux user accounts or elevating to the root administrative shell using su or su - is a fundamental routine for server maintenance and DevOps management. However, entering the expected password frequently triggers the blunt terminal rejection: “su: Authentication failure”. This failure halts administrative tasks immediately. On modern Linux distributions (such as Ubuntu, Debian, CentOS, and Fedora), this error is rarely a simple typo. It is typically caused by locked root account defaults, strict Pluggable Authentication Module (PAM) security configurations, or wheel group restrictions. Understanding how PAM governs su allows you to restore administrative access securely.

Why Does ‘su: Authentication failure’ Occur in Linux?

The su (substitute user) utility interacts with system authentication layers and PAM security stacks. Key causes include:

  • Locked Root Account by Default (Ubuntu / Debian): Ubuntu and its derivatives do not configure a root password during installation. The root account entry in /etc/shadow is set to ! or *, rendering direct su - authentication impossible.
  • Target Password vs User Password Confusion: su requires the password of the target user (e.g. root), whereas sudo requires the password of the current calling user.
  • PAM Wheel Group Restrictions: Security-hardened Linux systems enforce pam_wheel.so in /etc/pam.d/su, restricting su access exclusively to users explicitly listed in the wheel administrative group.
  • Shadow File Permissions or SELinux Restrictions: Incorrect permissions on /etc/shadow or SELinux security context denials blocking su setuid root capabilities.

Step 1: Use ‘sudo -i’ or ‘sudo su -‘ Instead of Bare ‘su’

On distributions where the root account has no assigned password, elevate privileges through sudo using your personal administrator password.

  1. In your terminal window, execute:
    sudo -i
    (Alternatively, run sudo su -)
  2. When prompted for [sudo] password for user:, enter your current user’s password, not the root password.
  3. If your user is in the sudo or wheel group, you will immediately receive an interactive root login prompt (root@hostname:~#).

Step 2: Set or Unlock the Root Account Password

If your workflow explicitly requires direct su - access, assigning a password to the root user unlocks the account in /etc/shadow.

  1. Execute the password change command using your sudo privileges:
    sudo passwd root
  2. Type a strong, unique root password and press Enter.
  3. Retype the password to confirm.
  4. Now test switching to root directly using su:
    su -
  5. Enter the root password you just configured. The shell will switch immediately.

Step 3: Audit PAM Configuration and Add User to Wheel Group

On enterprise systems (such as RHEL, Rocky Linux, or AlmaLinux), the PAM security stack may strictly reject users who do not belong to the wheel group.

  1. Elevate using sudo and inspect the PAM configuration for su:
    sudo nano /etc/pam.d/su
  2. Look for the line:
    auth required pam_wheel.so use_uid
  3. If this line is active (uncommented), only members of the wheel group can execute su.
  4. Add your standard user account to the wheel group:
    sudo usermod -aG wheel $USER
    (On Ubuntu/Debian, use sudo usermod -aG sudo $USER)
  5. Log out of your SSH session or terminal session and log back in for group membership changes to take effect.

Step 4: Verify File Permissions and Setuid Flags on the ‘su’ Binary

The /bin/su binary must possess the setuid permission bit (-rwsr-xr-x) so that it can temporarily execute with root capabilities to verify hashes against /etc/shadow.

  1. Check the file permissions of the su binary:
    ls -l /bin/su
  2. The output must look like:
    -rwsr-xr-x 1 root root ... /bin/su
  3. If the s flag is missing (e.g. -rwxr-xr-x), restore the setuid bit:
    sudo chmod u+s /bin/su
  4. Verify that /etc/shadow has secure 000 or 640 permissions owned by root:shadow:
    sudo chmod 640 /etc/shadow
    sudo chown root:shadow /etc/shadow

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.