Software⏱️ 3 min read📅 2026-06-15

How to Fix: sudo su - with error su: failed to execute /bin/bash: Permission denied

sudo su - permission denied on Red Hat Enterprise Linux Server release 7.7

Quick Answer: The issue is likely due to the user's home directory not being owned by the user, causing the 'Permission denied' error when trying to execute /bin/bash.

The error 'sudo su - with error su: failed to execute /bin/bash: Permission denied' affects users who are trying to use the sudo command followed by su, but facing permission issues. This can be frustrating for system administrators and power users who need to switch betweenuser accounts or run commands that require elevated privileges.

This issue is particularly challenging because it seems like all permissions should be set correctly with the ALL = (ALL) ALL configuration in the sudoers file.

🛑 Root Causes of the Error

  • The primary reason for this error is a mismatch between the user's effective and login groups. When a user logs in, their effective group is the same as their login group, but when they run 'sudo su -', the shell changes to the root group, which may not be the same as the user's login group. This can cause permission issues when trying to execute certain commands.
  • Another possible reason for this error could be a problem with the user's home directory permissions or if there is an issue with the sudoers file configuration.

🛠️ Step-by-Step Verified Fixes

Chown /bin/bash

  1. Step 1: To fix this, we need to change the ownership of the /bin/bash executable to the current user. We can do this by running the command 'chown $USER:$GROUPID /bin/bash'. This will set the ownership of the file to the current user's ID and group ID.
  2. Step 2: After changing the ownership, we need to update the permissions of the file to ensure that it is readable and executable by the current user. We can do this by running the command 'chmod u+x /bin/bash'.
  3. Step 3: Once these steps are completed, we should be able to run 'sudo su -' without encountering any permission issues.

Check sudoers file configuration

  1. Step 1: As a precautionary measure, let's check the sudoers file configuration to ensure that it is set correctly. We can do this by running the command 'visudo -f /etc/sudoers'. This will open the sudoers file in a text editor where we can verify that the ALL = (ALL) ALL configuration is correct.
  2. Step 2: If everything looks good in the sudoers file, we should be able to run 'sudo su -' without encountering any permission issues.

🎯 Final Words

To summarize, the error 'sudo su - with error su: failed to execute /bin/bash: Permission denied' can be resolved by changing the ownership of the /bin/bash executable or checking the sudoers file configuration. By following these steps, users should be able to run 'sudo su -' without any permission issues.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions