How to Disable “su” Access for Sudo Users?


When it comes to system security, it is essential to restrict root access as much as possible, especially when multiple users have access to the system. One of the ways a user can gain root access is by invoking the “su” command.

While the su command allows a user to switch from one user account to another, it can be misused or abused by users with sudo privileges. In this article, we will explain what “su” access for sudo users means, why it's important to disable "su" access for sudo users and how you can do this.

Explanation of “su” access for sudo users

In Unix-based systems, "sudo" is used in place of logging in directly as superuser or root. By using "sudo," a regular user account can temporarily gain elevated permissions for administrative tasks required for the smooth running of the system.

The “sudoers” file controls who has permission to use “sudo”. However, with some configurations, these privileged users might still have unrestricted root-level Substituting User (Su) capabilities through the su command.

Understanding Sudo and Su Commands

Explanation of sudo command

The sudo command is a powerful tool that allows users to carry out administrative-level tasks without the need for root access. It operates by prompting users for their own passwords instead of the root password, ensuring that only authorized users can execute privileged commands. This feature makes it easy for system administrators to delegate specific tasks to non-root users, providing an additional layer of security by limiting potential damage caused by human error or malicious intent.

Both the sudo and su commands are essential tools in managing Unix-based systems. While they serve similar purposes, there are fundamental differences in how they function and what they allow users to do.

Understanding these differences is crucial in maintaining proper system security protocols and preventing unauthorized access or misuse of privileged accounts. In the next section, we will explore some of the risks associated with allowing sudo users access to “su” commands and why it’s essential to disable this feature unless absolutely necessary.

Unauthorized Access to Root Privileges

The most significant risk associated with “su” access for sudo users is unauthorized access to root privileges. If a malicious or careless user gains access to root privileges via “su,” they can execute any command or change any file on the system without restriction. This includes deleting critical system files, installing malware, or modifying system configurations that can result in a security breach.

If an attacker gains control of a user account with “su” access, they could use it as a stepping stone for escalating their privileges on the target system and launching further attacks against other targets inside or outside of your network. In short, granting unchecked root privileges is one of the most dangerous things you can do in terms of computer security.

Security Risks Associated with Multiple Users Accessing Root Privileges

In addition to unauthorized access by malicious actors, there are also inherent risks when multiple users have “su” access on the same system. Allowing multiple users unrestricted administrative rights heightens the chance of conflicts arising between them when attempting to make changes or perform tasks on the same piece of hardware simultaneously. In such cases, it becomes difficult if not impossible to determine who executed what action when something goes awry – whether it was an innocent mistake or an intentional act of sabotage by one of the privileged users.

As such, disabling "su" access for sudoers reduces these risks while minimizing conflict and confusion that arise due to multiple users interacting with root privileges. In the next section, we’ll discuss how to disable “su” access for sudo users safely and effectively.

How to Disable “su” Access for Sudo Users

A Step-by-Step Guide If you have decided to disable “su” access for sudo users, you can do so by following these simple steps

Step 1 − Open the Terminal Window

To start, launch your terminal application. You can do this by pressing Ctrl+Alt+T on your keyboard or by searching for "terminal" in your system's application menu.

Step 2 − Edit the /etc/pam.d/su File

Next, use a text editor like nano or vim to open the /etc/pam.d/su file. This is where you will make changes to disable “su” access for sudo users. For instance, if you're using nano, you could type this command into the terminal &minnus;

sudo nano /etc/pam.d/su 

This opens the file in edit mode.

Step 3 − Comment out or Remove the Line that Reads: auth sufficient

Once you have opened the su file in edit mode, locate this line −

auth sufficient   

You need to comment it out or remove it entirely.

To comment it out, place a "#" symbol at the beginning of the line −

#auth sufficient     

Alternatively, simply delete the entire line from within your text editor. It is essential to note that some distributions might have different authentication mechanisms and configurations.

In such cases, modifying this configuration file might not work as expected. Therefore, ensure that you make informed decisions before making any changes.

Step 4 − Save and Exit the File

Save and exit from your text editor. If using nano as an example, you can save the changes by pressing Ctrl+X, then Y to confirm the changes, and finally Enter to exit from nano.

Once you have followed these four steps, “su” access for sudo users will be disabled on your system. This means that users who previously had access to root privileges using the “su” command will no longer be able to do so. This method is a simple and effective way of improving security on your system.


Disabling "su" access for sudo users is a critical security measure that system administrators should take to maintain the integrity of their systems. In this article, we have explored the concept of "su" access and its relation to sudo users, as well as the risks associated with allowing multiple users to access root privileges. We have also covered several methods for disabling "su" access, including editing the /etc/pam.d/su file and creating a separate group for administrative tasks.

It is important to note that while disabling "su" access can increase system security, it is not a replacement for other best practices such as strong passwords and regular software updates. System administrators should always employ a multi-layered security approach to ensure maximum protection against threats.

Updated on: 10-Jul-2023

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started