7

When installing Ubuntu I can create a user with an encrypted folder, what I always do. Now after the installation the login password for this user is also the sudo password. Is that how it should be? I actually would like to have a different user login and sudo password, does is make sense? Should I do that, how?

3

1 Answer 1

12

Yes, that is how it should be. Ubuntu is designed this way.

Benefits of using sudo (from the Community Help Wiki):

  1. The Ubuntu installer has fewer questions to ask.
  2. Users don't have to remember an extra password (i.e. the root password), which they are likely to forget (or write down so anyone can crack into their account easily).
  3. It avoids the "I can do anything" interactive login by default (e.g. the tendency by users to login as an "Administrator" user in Microsoft Windows systems), you will be prompted for a password before major changes can happen, which should make you think about the consequences of what you are doing.
  4. sudo adds a log entry of the command(s) run (in /var/log/auth.log). If you mess up, you can always go back and see what commands were run. It is also nice for auditing.
  5. Every cracker trying to brute-force their way into your box will know it has an account named Root and will try that first. What they don't know is what the usernames of your other users are. Since the Root account password is locked, this attack becomes essentially meaningless, since there is no password to crack or guess in the first place.
  6. Allows easy transfer for admin rights, in a short term or long term period, by adding and removing users from groups, while not compromising the Root account.
  7. sudo can be setup with a much more fine-grained security policy.
  8. The Root account password does not need to be shared with everybody who needs to perform some type of administrative task(s) on the system (see the previous bullet).
  9. The authentication automatically expires after a short time (which can be set to as little as desired or 0); so if you walk away from the terminal after running commands as Root using sudo, you will not be leaving a Root terminal open indefinitely.

Other Linux distributions use a separate root user with a different password. If you wish to use Ubuntu like that, you can set a password for root:

sudo passwd

Then you can log in as root from TTY or run su - from a terminal and enter the root password.

Once you can log in as root, you can remove yourself from the sudo group:

gpasswd -d <user> sudo
6
  • Thank you. But why is the design that way? I mean, if sombody finds out the sudo password the person can also get access to the data in the encrypted workplace (or vice versa). Is that not dangerous?
    – silla
    Jul 2, 2014 at 10:44
  • There is no such thing as a "sudo password". You have a user account that has sudo rights, that's all. This doesn't make it any easier to find out your password. This actually adds an extra layer of security, since an attacker might also have to guess your username, while they only have to guess the password if they know there is a user named "root".
    – kraxor
    Jul 2, 2014 at 10:52
  • Any half-competent attacker could get a list of usernames with a single command, so that doesn't add any security whatsoever. The fact is that: yes, you have to keep your passwords secret, and make sure they're hard to guess, otherwise you'll get screwed. Having two passwords, in this case, just wouldn't be any more secure.
    – evilsoup
    Jul 2, 2014 at 11:52
  • If a malicious user has access to an account that has root access, either via sudo or su, does not matter if sudo is using login (user password) or root password, root access is not far behind. I agree with @evilsoup , having to guess user names adds little, if any, security.
    – Panther
    Jul 2, 2014 at 14:55
  • 1
    @evilsoup To get a list of usernames you need to have some level of access already. SSH brute-force attacks always look for root passwords in my experience. So it does add some security. Then again, setting up fail2ban adds a 100 times more.
    – kraxor
    Jul 4, 2014 at 0:51

You must log in to answer this question.

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