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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. How To Create A SSH Banner in CentOS/RHEL Server
  2. blastn Command Examples in Linux
  3. How to enable core dump for Applications on CentOS/RHEL
  4. Strings and Variables in Python
  5. sestatus Command Examples in Linux
  6. CentOS / RHEL 6,7 : How to configure hugepages
  7. ssh-add Command Examples in Linux
  8. subscription-manager: command not found
  9. partprobe: command not found
  10. dnsmap: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-rebuild Command Examples in Linux
  • nixos-option: Command Examples in Linux
  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright