LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 11: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, 11:18 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,681
Blog Entries: 14

Rep: Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022
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, 12:21 PM   #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, 03:56 PM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,990

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
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, 05:03 PM   #5
Fred Caro
Member
 
Registered: May 2007
Posts: 999

Rep: Reputation: 166Reputation: 166
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, 05:22 PM   #6
snowpine
Senior Member
 
Registered: Feb 2009
Posts: 4,148

Rep: Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159Reputation: 1159
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, 05:56 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,691

Rep: Reputation: 2264Reputation: 2264Reputation: 2264Reputation: 2264Reputation: 2264Reputation: 2264Reputation: 2264Reputation: 2264Reputation: 2264Reputation: 2264Reputation: 2264
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, 08:34 AM   #8
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,681
Blog Entries: 14

Rep: Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022
"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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:04 PM
[SOLVED] Display the "lecture" when login as root with "su -" angel115 Linux - General 2 01-17-2011 05:57 AM
"su - root" giving incorrect password but normal root login works. ?? arashi256 Linux - Newbie 10 06-03-2010 04:13 AM
Getting bash to login as root and recognize commands like "vi" and "locate" ajaygoeslinux Linux - Software 4 05-04-2009 11:51 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 11:18 PM


All times are GMT -5. The time now is 12:11 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration