Pages

Thursday, June 29, 2017

Difference Between su and sudo and How to Configure sudo in Linux

Linux System is much secured than any of its counterpart. One of the way to implement security in Linux is the user management policy and user permission and normal users are not authorized to perform any system operations.
If a normal user needs to perform any system wide changes he needs to use either ‘su‘ or ‘sudo‘ command.

su vs sudo in Linux
Linux: su v/s sudo
NOTE – This article is more applicable to Ubuntu based distributions, but also applicable to most of the popular Linux distributions.

‘su’ Vs ‘sudo’

su‘ forces you to share your root password to other users whereas ‘sudo‘ makes it possible to execute system commands without root password. ‘sudo‘ lets you use your own password to execute system commands i.e., delegates system responsibility without root password.

What is ‘sudo’?

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‘.

Who can execute ‘sudo’?

We can run ‘/usr/sbin/visudo‘ to add/remove the list of users who can execute ‘sudo‘.
$ sudo /usr/sbin/visudo
A screen shot of ‘/usr/sbin/visudo‘ file, looks something like this:
su-vs-sudo
The sudo list looks like the below string, by default:
root ALL=(ALL) ALL
Note: You must be root to edit /usr/sbin/visudo file.
      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
                                                    ► Read more: http://adf.ly/1nBVTd
      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

No comments:

Post a Comment