Both of these are well known commands for getting privileges of a super user. Now, how does they differ from each other?
1. sudo : In case if a server needs to administered by a large number of users and you need permissions of root for a while ,it is not possible to give permission for all, you can use “sudo“,where you will have the permission for a short time in a restricted way ,means the sudo utility allows users defined in the /etc/sudoers configuration file to have temporary access to run commands they would not normally be able to due to file permission restrictions.You just have to type your password for getting access.
2. su : Becoming root for a complete Login Session if you know the password of root ,”su” will do it for you. su will help you become root from your user login.It allows users to switch the terminal to a different account by entering the username and password of that account. If no user name is given, by default it will become “root” , thus providing a fast method to obtain a login shell with full privileges to the system. Issuing an exit or logout command returns the user to their own account.
Related posts:
