This question already has an answer here:

I'd prefer to use root user as my default user instead of writing sudo command to get temporary root access. is the root user disabled by default ? how can i start using root user? what are the costs/benefits of this?

ps: I'm using Ubuntu 14.04 LTS and I'm completely new in Linux world.


marked as duplicate by saiarcot895, Panther, chaskes, Mitch Jul 29 '14 at 19:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 5
    Also, note that you can instead run sudo su to be in a root shell without enabling the root account login. – saiarcot895 Jul 29 '14 at 17:57
  • try this link and this – Lety Jul 29 '14 at 19:07

Short answer: don't do that.

If you want to run several commands as root, you can use sudo su - to get a root shell. This is useful if you're doing system maintenance, I personally do this when administering servers.

Other than that, it's a good habit to use sudo if and only if it's really necessary. This is both for security reasons and you're less likely to mess up your system.

If you find it annoying that you have to type your password too often, you could do a couple of things:

Extend the timeout for sudo

Edit /etc/sudoers (always use this command, never edit it any other way!):

sudo visudo

Find the line similar to this one:

Defaults        env_reset

Change it like so:

Defaults        env_reset,timestamp_timeout=30

This will make sudo ask for your password only if you haven't used sudo for 30 minutes.

Tell sudo not to ask password for specific commands

On one of my systems I use mount very often and it usually requires root permissions. For convenience, I've set up sudo so it doesn't require password for the mount command if you're in the "wheel" group. To achieve this, add a line as such to /etc/sudoers, again, using sudo visudo:

%wheel ALL=(ALL) NOPASSWD: /usr/bin/mount

Change /usr/bin/mount to whatever command you wish.

If you really, really, really want to use root as your normal user, and you understand the risks, use this tutorial. But again, you could also do it right.

  • Thanks, how can I find out which group i'm in? – user3627527 Jul 29 '14 at 19:47
  • Use the groups command. Note that in Ubuntu you are in a group that has the same name as your username by default. – kraxor Jul 29 '14 at 19:51

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