Useful shortcuts for vi editor

Wednesday 19 December 2018

What are the differences of su/ su -/ sudo / sudo su in linux system?

Info: 
su means, switch user or substitute user
sudo means, super user do
to use sudo command, related user must be defined in sudoers file

$ su -
(switch user to root then executes all /etc/profile, .profile and .bashrc files by root)

$ su
(switch user to root user then executes only .bashrc file by root)

$ sudo su -
(switch user to root then executes all /etc/profile, .profile and .bashrc files by root if current user defined in sudoers file)

$ sudo su
(switch user to root then executes only .bashrc file by root if current user defined in sudoers file)

Ref: https://ozsoyler.blogspot.com/2016/09/how-to-gain-root-access-without_15.html