Comments on Understanding the difference between sudo and su command on Linux

In this article, we will discuss in detail the 'su' command as well as how it differs from the 'sudo' command. The main work of the su command is to let you switch to some other user during a login session. In other words, the tool lets you assume the identity of some other user without having to logout and then login (as that user).

5 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: amos

$ sudo -iu user

Acchieves similar results to

$ sudo su -l user

By: RussH

of course sudo can be interactive too, just use sudo -i 

By: mik

Great article! thanks

By: LuisCusihuaman

Thank you very much, this article helped me a lot!

By: Mauro

Who can tell me why I get 2 different results from these 2 commands? Should I get the same results, shouldn't I?