• 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 allow or deny telnet login to specific users only in CentOS/RHEL
  2. CentOS / RHEL : Resize (extend) non-root EXT3/4 filesystem on non-LVM device (hard disk partition)
  3. CentOS / RHEL : How to create and host yum repository over httpd
  4. How to Troubleshoot Performance Issues on Linux – Beginners Guide
  5. How to create a networking bridge under CentOS/RHEL
  6. lvdisplay error: “Failed to create directory /var/lock/lvm. File-based locking initilisation failed.”
  7. How to Re-generate initramfs and vmlinuz for Rescue Kernel with Current Kernel in CentOS/RHEL 7
  8. Understanding chroot Jail
  9. How to change the audit log path in the MySQL Docker
  10. CentOS / RHEL 6 : Install and Configure SNMPv3

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright