2

Hi I have Ubuntu Server 14.04.2 LTS installed and when I use sudo with my regular username it requests my username password instead of the root password. Is this normal? If not, how do I set it up to ask for the root password?

  • That is what sudo is supposed to do. Read the man page for more information. – Anders Apr 3 '15 at 12:33
6

That is normal. User which you are logged in as is in the group sudoer.

Also, if you want, you can create root user - but it is not recommended. That will make a known target for crackers to attack your system.

Enabling

To actually enable root logins first you have to set a password for the root account and then unlock the locked root account. If you don't set a password for the root account the passwd command will return

passwd: unlocking the password would result in a passwordless account.  

So, first execute in a terminal

sudo passwd root

you will prompted for a new Unix password. Write it twice(second for confirmation).

Then execute

sudo passwd -u root

to unlock the account. This should return

passwd: password expiry information changed
| improve this answer | |
  • Thanks for the info. But then what is the point of root if I can create a user and just use sudo? I thought the point of root was to allow the final permission. But executing sudo with just a regular username and password defeats that purpose. @2707974 – thankgodforthissite Apr 2 '15 at 7:53
  • 1
    The risk with using root is that any action you trigger (or occurs while you are root) will run as root (with unlimited privileges). Whereas, with sudo only commands you want will run as root (level of privilege). This ('sudo') is a mature implementation of least privilege, complete with logging, and is much safer than using root. – david6 Apr 2 '15 at 8:58
  • The command sudo let you decide which users can run what commands. And it let you do that without knowing the other users passwords. Sharing password is a absolutely no when it comes to security. You plainly doesn't do that, no excuses. And with sudo you even can run commands as a locked user that can't log in. That makes the bar of cracking the system much higher. So, don't run as root user. Don't surf as root user. Lock down root user as much as you can. Only use root user when you must, not when it is convenient. We don't want the Microsoft way in Linux. – Anders Apr 3 '15 at 12:40
  • 1
    You need to be a member of sudoers to be allowed to run sudo, and you are limited to using only the functions which sudoers allows you to use (for full administrative users, everything; but you can give a user only some of the privileges, and they can use sudo for only those operations). If a normal unprivileged user tries to use sudo to perform a task that requires privileges, they'll get a permissions error. – outis nihil Apr 3 '15 at 13:36
  • And, you can track use of the root. It also gives you traceability. Locking root user will also lock a possible known account on your computer, which make it harder to crack your computer. – Anders Apr 7 '15 at 0:26
3

I suggest NOT to activate root.

If you need a terminal as root, open up a terminal and type

sudo -i

then you will get a root terminal if neede.

Else stick with what david6 suggested, only execute your specific command as root.

This is best practice nowadays.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.