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 understand it has privileges to everything and should only be used when really needed and then logged out. However I have a couple of questions,
1. Is the root user password hashed/encrypted?
2. If the root account is disabled (like on linux mint) could a "virus" enable it?
3. If a "virus" could enable the root account, couldn't it then also set up the root password since it was never set before?
Those are system account, starting with root (there are more, including user accounts).
/etc/passwd is made of of fields separated by colons; the last field contains the shell program started at log in. On my systems, I define that as KornShell rather than BASH, so it's /bin/ksh instead of /bin/bash.
The other "optional user command interpreter" (that's the last one) are specified /bin/false so no one can log in to any of those user accounts (they're not really user accounts, they're for system administration). You should not fool around with any of them for any reason, by the way.
Now, the second field, "optional encrypted password," contains an "x" indicating that the actual encrypted password is stored in /etc/shadow. That looks something like this (note: you must be root to see the shadow file):
There is one line in /etc/shadow corresponding to each line in /etc/passwd. If the second field in /etc/shadow is an asterisk, there is no password (and no log in is possible).
Anybody can read /etc/passwd (you can look at); nobody, except root, can read /etc/shadow. The permissions on those two files should never be fiddled around with for any reason.
Now, about "viruses."
Essentially, you want to use strong passwords:
Quote:
Compromises in password security normally result from careless password selection
or handling. For this reason, you should not select a password which appears in a
dictionary or which must be written down. The password should also not be a proper
name, your license number, birth date, or street address. Any of these may be used
as guesses to violate system security.
For example, "good" passwords include upper- and lower case letters, numeric characters, punctuation characters and are at least eight characters in length (longer is even better) -- read the Wikipedia article.
Viruses? Not really applicable (this ain't Windows). You protect yourself with good passwords.
You should take some time and read the manual pages for passwd and shadow and, perhaps, the "See Also" references at the bottom of each of those manual pages for a better understanding of how all this works:
Using strong passwords lowers overall risk of a security breach, but strong passwords do not replace the need for other effective security controls. The effectiveness of a password of a given strength is strongly determined by the design and implementation of the authentication system software, particularly how frequently password guesses can be tested by an attacker and how securely information on user passwords is stored and transmitted. Risks are also posed by several means of breaching computer security which are unrelated to password strength. Such means include wiretapping, phishing, keystroke logging, social engineering, dumpster diving, side-channel attacks, and software vulnerabilities.
Alright but so shouldn't all distributions when installing allow someone to set a root password and then after installation disable the account? It's better to have some type of password in there than none at all since it may be possible for a virus to enable the root user account. I see this as a major flaw in Linux right now.
Very few distros operate on the sudo-only principle with the root account disabled. Most Linux distros still make you (or at least allow you to) set up a root password during installation. If you dislike the sudo-only no-root-account way of doing things (you're not alone in this camp), then don't run those distros.
Disabling root login doesn't mean that root privilages are inaccesible. This root account is still needed for other purposes than login to system, like for maintance by user. To enable root account virus or other user need to known administrator password (or somehow other method of authorization to use this account), it is irrelevant which password it would be (root or other account). Passwordless root account has other purpose, like allowing specified users to execute privilaged commands, or commands as another user, without giving them password for root, therefore full access to system.
Also you can't say "all distributions" - not all of them are multiuser (on some of them only root account exist). Also not everyone want disabled root account, it all depends on actual use of system. And for example, on Ubuntu you can choose during installation (precisely a sudo package) if you want to have disabled root account or not.
Alright but so shouldn't all distributions when installing allow someone to set a root password and then after installation disable the account? It's better to have some type of password in there than none at all since it may be possible for a virus to enable the root user account. I see this as a major flaw in Linux right now.
If I log in to a brand new system such as debian, as a user with all access in the sudoers I have the ability to set the root password. Even if it has already been set. In my opinion the security flaw is SUDO itself. On a desktop system I prefer to have it for simplicity. I would think that secure servers would be better off without sudo.
I would think that secure servers would be better off without sudo.
Secure servers are better off with sudo. But only if it is configured properly, in the way it was intentionally thought, for letting specific users or groups run some specific tasks with root privileges without giving them a general root-access to the machine. Of course, if you are the only person that administers a server sudo usually is unnecessary (and not existent on my servers).
On my desktop/laptops I keep it for convenience, for running some specific commands without the need for a password.
I would think that secure servers would be better off without sudo.
As Tobi said, secure servers are better off with a properly configured sudo. It enables users to do the operations they need without having to dig out the huge root password every time, which makes things both faster and more secure (fewer people have access to the root password, the root password doesn't need to be accessed as often, etc.). As it's set up on many systems though, with the first user created on the system having full sudo power, it is certainly less secure than without sudo though.
In my opinion, in order of most secure to least secure, it goes:
1) true root user plus properly configured sudo
2) true root user with no sudo (RHEL/CentOS default)
3) no root user and the first user account has full sudo power (Ubuntu default)
Secure servers are better off with sudo. But only if it is configured properly, in the way it was intentionally thought, for letting specific users or groups run some specific tasks with root privileges without giving them a general root-access to the machine. Of course, if you are the only person that administers a server sudo usually is unnecessary (and not existent on my servers).
On my desktop/laptops I keep it for convenience, for running some specific commands without the need for a password.
While I agree that it would be more secure if utilized properly, which many people do not do. Most of that security can be done simply by fully utilizing groups. Yes, I know it doesn't require a user to enter his password again but that probably isn't really necessary if his only access elevation is to run one or two programs.
Where I think the system becomes insecure, is that if there is more than one user able to set the root passwd, then there is now two root accounts. Twice the opportunities to compromise the system.
Most of that security can be done simply by fully utilizing groups. Yes, I know it doesn't require a user to enter his password again but that probably isn't really necessary if his only access elevation is to run one or two programs.
Would work also. But is lacking a feature of sudo that most people simply forget: with a proper configured sudo you can have logging which user used sudo for invoking which command, which can make things much easier for the admin.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.