logging in as root

Tim Chase blinux.list at thechases.com
Sat Feb 21 23:23:35 UTC 2009


> How do I log out, and log back in as root under vinux in order
> to install it? useing sudo seems to be a bit tedious.

There are a couple options:  You don't have to log out as one 
user to issue multiple commands as root.  You can just run a 
root-shell instead:

   sudo bash

This will drop you in a bash shell as the root user.  Every 
command you type in that shell session will be executed as the 
root user.  If you need to issue multiple commands, this is a 
pretty good way to do it.  When you're done, just type "exit" to 
leave that shell session and return to your non-privileged user 
account.

If your problem is typing the password every time you run sudo, 
it can be configured to remember that you've been validated and 
not prompt for the password.  I believe the default is 15 minutes 
between sudo commands (though you can revalidate to stay logged 
in).  It's been a while since I've monkeyed with this, but you 
should be able to tweak the /etc/sudoers file to include 
information about the "timestamp_timeout" (details should be 
available by issuing "man sudoers" and searching for that 
command).  With this in place, you have to enter your password 
the first time, but any commands entered within the 15-minute 
window reset the count-down timer so you don't have to keep 
entering the password -- you just enter the "sudo" bit.  However, 
you may already have this configured and want to stop using 
"sudo" altogether.  If so, read above for the preferred way to do it.

Lastly, you *can* log in as root.  However, if you're running a 
distro like Ubuntu which doesn't have a password for root (it's 
set up as an account that can't be logged-into), you have to set 
it.  You can use

   sudo passwd root

to set a new password for the root account.  Then, at your login 
prompt, you can log in as "root" and give the password you 
created.  Note that this is often dangerous to do because any 
foul-ups can hose your entire system.

Hope this helps.

-tim









More information about the Blinux-list mailing list