Monday, February 22, 2016

su vs su - on linux server

su gives you root permissions but it does not change the PATH variable and current working directory. so you can't execute files in /usr/sbin folder.

su - changes the PATH too... and root's home becomes your current working directory. you become proper root and can execute all commands.

$ su 
$ echo $PATH
$ pwd

note down the output of path and pwd. now execute su - 

Check the difference.

No comments:

Post a Comment