What Is The Difference Between Sudo And Su In Linux?


A Linux user comes across sudo and su in terminal very often. If you are a new Linux user, you might be fascinated by the things you can do with sudo and su.

Key differences between sudo and su

The su command stands for super user or root user. It executes on a Linux system with no additional options. The user just needs to add root account password. In the terminal, su also lets you access any other user account using the required password. That’s why su also stands for substitute user or switch user. Simply type su followed by the user account name, e.g., sudo fossbytes, and you’ll enter the password for fossbytes. After completing the job, you can exit the root shell by typing exit. Overall, su basically starts another shell instance with the privileges of the intended user.

On the other hand, sudo runs a single command with root permissions. When a user runs a command with sudo, e.g., sudo command, he/she needs to enter the current user account password to run it as root user. Sudo uses a config file (/etc/sudoers) to define the rights of different users. For detailed information on sudo, you can read our detailed article written by Devin  Sudo in Linux

Comparing the both, sudo lets one use the user account password to run system command.

Post a Comment

Previous Post Next Post