Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

Thanks,

share|improve this question

marked as duplicate by saiarcot895, bodhi.zazen, chaskes, Mitch Jul 29 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.

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

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
Thanks, how can I find out which group i'm in? –  user3627527 Jul 29 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 at 19:51

Type this command

sudo usermod -u 0 -o your-username

now you-user account works same as root user.

share|improve this answer
3  
Setting the UID of a non-root account to 0 is a bad idea. There are some programs out there that either except you not to run it as root (Chromium and sbuild comes to mind) or may have other bugs when running as root. See also this question. –  saiarcot895 Jul 29 at 17:53
    
not working. for example reboot or apt-get update still need root permission. –  user3627527 Jul 29 at 18:22
    
not for me. its running fine for me. –  Dishank Jul 29 at 18:52
    
It is bad for security or professional point of view. He said he have use sudo for update or else, for normal users it is good. –  Dishank Jul 29 at 18:55

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