4

I have a laptop on which I'm the only user. While installing the laptop I was wondering why I should choose a different password for the root account and user account. My reasoning is:

  • The change of finding a valid password doubles if the user and root have different passwords. Of course the salting algorithms make sure that the same password will result in different hashes but still if one starts to guess passwords it increases the change of finding a good one.
  • The user has sudo rights so if an hacker finds the user password it can sudo and have the same powers as root. More or less the same is true if the root account is hacked.
  • I have disabled the ssh service on this laptop. There are no other ways to login from remote on this machine.
  • The filesystem is encrypted with a different password.

What are the flaws in my thought process?

6
  • 2
    If sudo gives you all the privileges, then having separate accounts is useless. Otherwise, if you separate the privileges, it does make sense to have a separate root account and it's actually a more secure setup IMO.
    – reed
    Commented Nov 27, 2020 at 11:53
  • And, in most distributions, the root user's password is not set by default. You need to set it with sudo passwd root. You can do all actions with sudo, not need for the root.
    – kelalaka
    Commented Nov 27, 2020 at 14:19
  • @kelalaka I know about the option not setting the root password. The only risk I see is when somehow you mad a error in your profile config or the the shell breaks. Then you couldn't login as a normal user anymore. With a root account with a system default shell and no profile config you could still log in and rescue your account. Commented Nov 28, 2020 at 9:42
  • @reed, I agree but like in the mentioned in the answer of Conor Mancone (and the xkcd comic) the most important thing to protect on your laptop is personal data. Having a sudo setup with restricted privileges doesn't add any more protection to personal data. Commented Nov 28, 2020 at 9:47
  • @reed For sudo to be able to give you the privileges of an account, you need that account to exist. I think you mean being able to log in to multiple accounts is pointless if you’re using sudo correctly. Commented Nov 28, 2020 at 17:32

3 Answers 3

3

It's all about your own personal risk tolerance and your threat model. In short, you are worried about someone who is physically in possession of your laptop and has guessed your user password, and you want to keep them from having full admin rights. I'm having a hard time coming up with a scenario where that may actually happen, so I can't help but think that you are overthinking this. Moreover, for most personal computers, the user account is typically more critical than admin access;

https://xkcd.com/1200/

Then again, remembering two passwords isn't much harder than memorizing one, so go for it if you want. Just make sure you have a way to copy your data off the machine without needing admin credentials - you'll want to do that if you ever forget your admin credentials and need to reinstall.

Still, I might suggest an alternate solution:

Use a strong password and don't tell it to anyone

2
  • Thank you for your reply. I'm not too worried about admin rights like mentioned in the xkcd comic but more about personal data. In my case I have a different password for disk encryption so if I cannot login to my system and can move the disk to another system and mount it with that password. Main question is if it is more insecure to have two accounts with different passwords on a system (one being root) instead of two accounts with the same password? Commented Nov 28, 2020 at 9:51
  • Maybe the best option is to disable login for root all together like @kelalaka mentioned and in the unlikely event of locking yourself out you can place your disk in another system and repair your system. Commented Nov 28, 2020 at 9:53
1

Here are some reasons why it may make sense to have different passwords for user and for root.

  1. I suppose you are using the normal user account much more often than the root account. If you log in in some public places as normal user, then the probability that somebody sees your password is much higher than the probability to see your root password. Then, if in doubt, you just change you user password, but you can keep the root password. Also if you use your laptop often in public places, you may want to change password regularly, let say every 3 months. Again, in such cases it will not be needed to change also the root password. Thus it may well make sense to have different passwords.

  2. If you gave your user in sudo unlimited rights, then having 2 different passwords doesn't help. But if you limited sudo rights to some operations only, then leakage of you user's password is not as dangerous as leaking the root password. Thus it may well make sense to have different passwords

0

In your case, you probably don't need a password login for your root account as your regular user has unrestricted sudo access.

Some distributions lock the root account password by default, like Ubuntu. And that is probably the safest way to go. You can lock the root password with:

sudo passwd -l root

This will prefix the password hash in your shadow file with ! or !!, depending on your distribution.

Be aware, locking a password is different than deleting a password. An empty password means, you can login without a password. That's probably not what you want. Also worth noting, a locked password is not equivalent to a locked account. A locked password just prevents any logins via password. Logins via SSH keys are still possible, if configured, and also impersonation of root via sudo su - is still possible.

So, yesn't. You actually do not need to care about your root password, if you lock it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .