Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
"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.
"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.
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.
"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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.