[conspire] Help with GRUB

Rick Moen rick at linuxmafia.com
Wed Nov 4 12:04:16 PST 2009


Quoting Nick Moffitt (nick at zork.net):

> In fact, sudo has two options for giving you a root shell:

Yeah, I've been guilty of ignoring details of sudo.

> 	1. sudo -s
> 		This basically gives you your existing shell environment
> 		but with root privilege.  It can be very dangerous
> 		because it's going to be "comfortable" (all your
> 		aliases, editor configs, etc will be there).  
		
Manpage detail:

       -s  The -s (shell) option runs the shell specified by the SHELL envi-
           ronment variable if it is set or the shell as specified in
           passwd(5).


> 	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.





More information about the conspire mailing list