Linux

How to fix SU authentication failure and Sudo Permission denied Prompt in Ubuntu

Slide2-1

In this short guide, you will learn how to fix the Su: Authentication Failure in Linux. With this error, you will also encounter the Permission denied message when trying to carry out any installation with sudo permission. In Linux, there are different types of users, and sudo or the root user is one of such users but a user with the full permission to execute any command in Linux. Sudo means superuser do. The superuser account is the account with unrestricted permissions and privileges. Take a look at the following related posts on How to Create Symbolic Links in Linux, How to Install Terraform on Linux, How to install Apache Tomcat on Ubuntu, and How to fix “Failed to open session in VirtualBox to install Windows 11 Image”

From the screenshot below, we’re are trying to switch user (su) to the root account so we can execute any command without a password prompt. Secondly, since the su command failed, we also tried to become root by running the sudo -i command but we encountered the Permission denied prompt. Thirdly, we tried to run the installation of the aptitude command using the usual sudo apt install aptitude command, we still faced the Permission denied prompt.

Su-authentication-failure1
Su: Authentication Failure

One of the things to note in Linux, su, and sudo commands fails with an authentication failure and “Permission denied” since the root account is blocked by default in Ubuntu, and the root account doesn’t have a password that’s why whenever we try to execute any command we’re prompted for a password. For best practice, it is not recommended to grant sudo permission to every user as doing so may pose danger to your system.

Let’s get the issue fixed! Before fixing this, we will first look at the cause of the problem.

Cause of the problem:

This problem usually occurs when you change the ownership of/usr/bin from root to an ordinary user or you have mistakenly granted both the owner, the group and others the full permission to read, write and execute (rwxrwxrwx) to the /usr/bin directory by running sudo chmod 777 /usr/bin/ or by granting the owner and the group the same permission to read and write (chmod 770 /usr/bin) to the /usr/bin directory with sudo power. By default the Root account in Linux OS doesn’t have password as mentioned earlier. So any attempt to alter the standard settings of the core filesystem will automatically disable all access to the sudo or root account until it is recovered.

With the incident described above, whenever you try to execute  any of the following commands: su root, sudo -i, $sudo chown root /usr/bin and chmod 4755 /usr/bin/sudo or any task that requires the superuser or root privileges to be executed, you will encounter the above error-, and even the chmod: changing permissions of '/usr/bin/sudo': operation not permitted error as well.

Solution

Step 1: Restart your PC. Boot into Ubuntu Recovery Console, and press and hold the SHIFT key while booting. It will take you to the grub loader page as shown in the screenshot below.

Entering-the-Grub-Menu
Entering the Ubuntu Recovery Console

Sometimes getting into the grub loader menu using the SHIFT key could be a little bit tricky mostly when you’re running your Ubuntu on VirtualBox or VMWare. So you need to start pressing the shift key immediately the VirtualBox screen displays.

Step 2: Select and enter Advanced options for Ubuntu, from there select the kernel named as recovery mode as shown in the screenshot below:

Recovery-Mode
Recover Mode

Step 3: Select root – by dropping to the root shell prompt as shown in the screenshot

Select-root-in-the-Grub-Menu
Root Kernel

Step 4: Now the file system is read-only. Remount to Read-Write by running the command below:

# mount -o remount,rw /

Now we need to mount –all

Mounting all requires us to change the ownership for sudo. To do so run the below command:

# chown root:root /usr/bin/sudo

Grant permission for sudo by running:

# chmod 4755 /usr/bin/sudo

Now, the deal is done and Sudo should be back by now. Let’s restart the PC by running the below command.

# shutdown -r now

The summary of all the commands ran above is shown in the screenshot below. Note: you’re to go with the “Press Enter for Maintenance prompt

Cammands-to-recover-your-OS

Outcome

After restarting our PC, we have the Sudo back and we can run the sudo-i command as well as run the aptitude command installation without the su: Authentication Failure error prompt as shown in the screenshot below.

Root-account-Restored
Sudo Restored

That’s all..! I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest

1 Comment
Inline Feedbacks
View all comments
timitar
timitar
20 days ago

very nice

1
0
Would love your thoughts, please comment.x
()
x