• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

“su: Authentication failure” – in Docker

by admin

The Problem

In some situations, a normal user within a Docker container cannot run ‘su’ command to switch user. When ‘su’ command is issued, the following error returns.

$ su -
Password: [entering correct password]
su: Authentication failure

The Solution

The sticky permission may be missing in /usr/bin/su within the container. With root privilege, you may fix as follows:

1. First check the current permissions for the /usr/bin/su binary file.

# ls -l /usr/bin/su
-rwxr-xr-x 1 root root 32208 Mar 14 01:39 /usr/bin/su

As we can see in the output above, the sticky bit permissions are missing.

2. Add the sticky bit permissions the the /usr/bin/su file as follows:

# chmod u+s /usr/bin/su

3. Verify the permissions again and check for “x” flag at the end of permission field.

# ls -l /usr/bin/su
-rwsr-xr-x 1 root root 32208 Mar 14 01:39 /usr/bin/su

4. Try doing su again inside docker container.

$ su - postgres
Password:
Last login: Tue Aug 6 12:13:57 JST 2019 on pts/1
postgres@[hostname] $ 

Filed Under: DevOps, Docker, Linux

Some more articles you might also be interested in …

  1. mk Command Examples
  2. 2to3 – Automated Python 2 to 3 code conversion
  3. st: command not found
  4. lrzuntar Command Examples in Linux
  5. dumpe2fs: command not found
  6. ntpdate Command Examples in Linux
  7. AdGuardHome – A network-wide software for blocking ads & tracking (Command Examples)
  8. meld Command Examples
  9. apache2ctl: command not found
  10. Mac Terminal diskutil Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright