sudo su - versus sudo -i
In a thread I suggested to use sudo su - to become root temporarily. I was advised that sudo -i would be a better choice.
I'm very curious why that is the case. Threads that I've found omit the dash from the first command, so don't apply.
Code:
"var" |"sudo su -" |"sudo -i"
--------------------+---------------------------------------------------------------+--------------------------------------------------------------------------
"SHELL" |"/bin/bash" |"/bin/bash"
"TERM" |"linux" |"linux"
"USER" |"root" |"root"
"LS_COLORS" | |
"MAIL" |"/var/mail/root" |"/var/mail/wim"
"PATH" |"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
"PWD" |"/root" |"/root"
"LANG" |"en_ZA.UTF-8" |"en_ZA.UTF-8"
"SPEECHD_PORT" |6560 |6560
"SHLVL" |1 |1
"HOME" |"/root" |"/root"
"LOGNAME" |"root" |"root"
"LESSOPEN" |"| /usr/bin/lesspipe %s" |"| /usr/bin/lesspipe %s"
"LESSCLOSE" |"/usr/bin/lesspipe %s %s" |"/usr/bin/lesspipe %s %s"
"_" |"/usr/bin/env" |"/usr/bin/env"
--------------------+---------------------------------------------------------------+--------------------------------------------------------------------------
"XDG_SESSION_COOKIE"|"a7a40db8cf4c937acb049b764d08c288-1312375570.325101-1940988668"|
"SUDO_USER" | |"wim"
"SUDO_UID" | |1000
"USERNAME" | |"root"
"SUDO_GID" | |1000
Highlighted in red are the differences in the environment (mail, path and the 5 lines at the end). Please explain to me why sudo -i is the better choice.
If you don't make backups of your important data, your data is obviously not important to you.
Bookmarks