default root pwd for base system install?

Tim Frost timfrost at xtra.co.nz
Tue Jan 10 05:18:12 UTC 2006


On Tue, 2006-01-10 at 14:39 +1100, Ronny Haryanto wrote: 
> On Tuesday 10 January 2006 13:08, William Grant wrote:
> > Adam Goodbar wrote:
> > >If you need a root shell, but dont want to login as root, you can use
> > >'sudo bash' or 'sudo su' to start a shell with root privilages, even
> > >though you are logged in as your normal user.
> >
> > sudo -i would do the same thing, and is the proper way.
> 
> Hm, I thought it was 'sudo -s'?
> 
> Ronny

It depends on what you want. 
sudo -i:
* creates a login shell (runs ~root/.bash_profile, /etc/profile)
* resets environment (eg DISPLAY variable is cleared)

sudo -s:
* runs the shell specified in /etc/passwd
* preserves much of the environment



tim at marvin:~/tmp$ sudo -i
root at marvin:~# env | wc -l
16
root at marvin:~# logout
tim at marvin:~/tmp$ sudo -s
root at marvin:~/tmp#  env | wc -l
34
root at marvin:~/tmp#



With sudo -s, you can run GUI tools (gedit, etc), but with sudo -i, you
can't run GUI tools because you don't have access to the X server





More information about the ubuntu-users mailing list