[conspire] sudo -i vs sudo su - ? [Was:] Help with GRUB
Steve M Bibayoff
bibayoff at gmail.com
Wed Nov 4 14:58:20 PST 2009
Hello,
On Wed, Nov 4, 2009 at 12:04 PM, Rick Moen <rick at linuxmafia.com> wrote:
> Quoting Nick Moffitt (nick at zork.net):
[...]
>> 2. sudo -i
>> This is basically equivalent to "sudo su -", in that it
>> drops you into the root environment as it's configured
>> on the machine.
>
>
> -i The -i (simulate initial login) option runs the shell specified in
> the passwd(5) entry of the user that the command is being run as.
> The command name argument given to the shell begins with a "-" to
> tell the shell to run as a login shell. sudo attempts to change to
> that user's home directory before running the shell. It also ini-
> tializes the environment, leaving TERM unchanged, setting HOME,
> SHELL, USER, LOGNAME, and PATH, and unsetting all other environment
> variables. Note that because the shell to use is determined before
> the sudoers file is parsed, a runas_default setting in sudoers will
> specify the user to run the shell as but will not affect which
> shell is actually run.
>
> On reflection, "sudo su -" is probably the method one should favour.
Reason?
I instinctively run "sudo su -" instead of "sudo -i", but really don't
know why(probably because I learned the former first or maybe because
I use "su user" alot)
Steve
More information about the conspire
mailing list