LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-09-2012, 10:07 AM   #1
sgull
LQ Newbie
 
Registered: Mar 2012
Distribution: Mint 12 and Lucid Puppy dual boot
Posts: 16

Rep: Reputation: Disabled
"login as root" explanation please


I'd like some help understanding what exactly is meant by an instruction to "login as root". Does it mean login to the computer with the use of a root password, and if so is there any difference between a root password and a sudo password? Apparently sudo means "superuser", and is that the same as a root user? If I'm the superuser and I need to type sudo before particular commands in a console and then get prompted to type in the password, is that always the same as what is the root password? From trying to look into it a little, I get warnings how it's not always a good idea to just more or less habitually issue all commands with sudo, but I don't know how one knows which type of commands you wouldn't want to.

I googled some and read about this stuff but so far have not come across a source of information that explains this in simple enough terms that I can get a grasp of it. Any help/comments appreciated in regard to this inquiry.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 04-09-2012, 10:18 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
root = The "super user".

su = Switch user.

sudo = Super User Do

When you "login as root" you enter "root" at the login prompt then supply root's password.

When you use sudo it prompts for the password of the user you logged in as initially instead of root's password. It also keeps track of commands in logs.

When you do "sudo su -" you are saying to use Sudo to switch user from the one you logged in as to the root user.

When do "sudo <command>" you are saying to run the command as the root user even though that is not the user you are logged in as.

Opinions are varied as to what makes most sense. For logging purposes issuing ever command with sudo would be good but maddening. Some distros try to force you to do it. Experienced admins like myself typically prefer to do the "sudo su -" to switch to root user which prevents needing to type sudo for each command.

When something tells you to "login as root" it typically means simply to be the root user when you do what follows so either a direct login or a sudo to root would work. For a very few things doing sudo to become root does NOT work as well as a direct login so you're forced to do the direct login. Usually I will do the "sudo su -" and only do a direct login when something fails (or explicitly says that sudo wouldn't work).

The beauty of always using sudo is you only have to remember your password and not root's. Of course there are occasions you'll need to know root's (e.g. if you're troubleshooting a very unhealthy system where few utilities are working and you must be on the console) so you definitely want to keep the root password in a secure location that you can access if necessary.
 
2 members found this post helpful.
Old 04-09-2012, 11:21 AM   #3
sgull
LQ Newbie
 
Registered: Mar 2012
Distribution: Mint 12 and Lucid Puppy dual boot
Posts: 16

Original Poster
Rep: Reputation: Disabled
Thanks MensaWater for the helpful reply. Don't think I ever wrote down my root password though. I think I know what it is though. Although I don't recall ever being prompted to enter it for anything.

One distro I happen to have installed along with Mint is Puppy. By default, the way I understand it, Puppy logs you in as root. And apparently if you want, you can "install" sudo so you can use that instead. That's kind of the main reason for my inquiry, to try to understand my way around that business, and what to do, if anything, in that regard.
 
Old 04-09-2012, 02:56 PM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,504

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
If you are using Linux Mint, you would use sudo and the password you are prompted for is the password of the primary user, usually the one you created during the installation. You won't have a "root" user by default. I believe Puppy still runs as root by default, I don't have it installed so...? There are hundreds of different Linux distributions and most of them require a root user and password to be created during an installation as well as a user. Ubuntu and its derivatives such as Mint, use sudo by default.
 
1 members found this post helpful.
Old 04-09-2012, 04:03 PM   #5
Fred Caro
Senior Member
 
Registered: May 2007
Posts: 1,007

Rep: Reputation: 167Reputation: 167
sudo vs. su or 'whereis my root password'

"sudo su-" sounds like a good move but what if you only have a "sudo" password on a pc. Having a root event with its own password seems a lot more simple, not least for changing the root password. Having a group called 'sudoers' (or such like) on a pc seems to only compilcate what was quite straightforward; might be missing something.

Fred.
 
Old 04-09-2012, 04:22 PM   #6
snowday
Senior Member
 
Registered: Feb 2009
Posts: 4,667

Rep: Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411
Quote:
Originally Posted by Fred Caro View Post
"sudo su-" sounds like a good move but what if you only have a "sudo" password on a pc. Having a root event with its own password seems a lot more simple, not least for changing the root password. Having a group called 'sudoers' (or such like) on a pc seems to only compilcate what was quite straightforward; might be missing something.

Fred.
sudo can be a little more work to set up, but it is practically a must in situations where there are multiple administrators for different tasks. You don't want multiple people sharing the same root password for several reasons; for example if an employee quits the organization, sudo allows you to simply revoke that user's admin rights rather than changing the root password for everyone.

For a single-user system I agree su vs. sudo is largely a matter of personal preference.
 
Old 04-09-2012, 04:56 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
More and more the distro's are being shipped without any easy way to access a root user. It is a security design that some may argue it's effectiveness. In a general sense you never want to be logged in as any user that has more permission than is needed to do a single task. Again some dispute on that.
 
Old 04-10-2012, 07:34 AM   #8
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
"sudo su -" really isn't that difficult to do. I'm a fairly lazy admin yet I do it all the time.

Many organizations simply don't like the idea of a "super" user and I've worked in more than one where they've actually proposed taking root away from the Systems Admins (I know - it boggles the mind). One way to mollify PHBs is to setup a policy wherein root logins are not supposed to be done and instead you are doing "sudo su -". In one organization I worked in the sudo setup was done by security administration and any time you did a "sudo su -" you had to explain why you needed to become root. That didn't bother me as it is fairly easy to show that many tasks an Admin does can only be done via root.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
xorg.conf : Explanation of "Viewport" and "Virtual" uncle-c Linux - Newbie 1 01-24-2011 11:04 AM
[SOLVED] Display the "lecture" when login as root with "su -" angel115 Linux - General 2 01-17-2011 04:57 AM
"su - root" giving incorrect password but normal root login works. ?? arashi256 Linux - Newbie 10 06-03-2010 03:13 AM
Getting bash to login as root and recognize commands like "vi" and "locate" ajaygoeslinux Linux - Software 4 05-04-2009 10:51 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration