For the most Linux distributions, su and sudo are widely used commands. In this article we will discuss what is the main difference between su and sudo commands.
What is ‘su’ command?
‘su’ commands forces you to share your root password to other users. When any superuser type su, it will prompt to enter the root password of the server.
What is ‘sudo’ command?
‘sudo’ is a root binary setuid, which executes root commands on behalf of authorized users and the users need to enter their own password to execute system command followed by sudo. sudo commands makes it possible to execute system commands without root password. Hence you do not require to share your root password to other.
If you do not want to shared your root password, you should add the user to sudoer list.