3

I installed Debian OS today and while installation I skipped the option to create root user and chose to use sudo. Now I would like to create root user account. Is there any way to create the root account now?

14

The root account is always there, you just need to set a password for it:

sudo passwd root

And enter a password when prompted to.

7

As most Linux experts believe so, creating a root account ain't a good idea and that's why people mostly stick to SUDO (Although, sometimes it might make you kind of nervous.) But if you can accept risks, this piece of code would activate a root account:

sudo passwd root

I'd suggest you deactivate it after you satisfy your need with it. You may want to take a look at this article for better understanding the case and the process:

http://sathyasays.com/2008/05/27/enabling-and-disabling-root-account-in-debianubuntu/

  • 1
    @Vynlyn You can also refer to this question: unix.stackexchange.com/questions/8581/… – Bichoy May 27 '15 at 7:03
  • Actually, enabling the root account (not creating: it always exists) is not intrinsically a security risk. It's a problem on multiuser systems (or more precisely multi-administrator systems) because if several people know the root password, you can't know who used it in a given instance. But having a root account that you can log into with the password is not less secure than having an account that can gain root with sudo. If it makes you nervous, you're uninformed or not thinking with security in mind. – Gilles May 27 '15 at 22:24
-3

The UID and the GID of root are 0. So you have to run those commands:

groupadd --gid 0 root
useradd --home /root --uid 0 --gid 0 root

You can name this account likeyou want, what's important here is the UID (user id).

  • 5
    Why would he create it? Shouldn't it be there by default? I know (at least in the old days), skipping the root account just doesn't set a password to it so nobody can login with it, but it is always there.... – Bichoy May 27 '15 at 6:51
  • Well I didn't know that :) – Dano May 27 '15 at 7:10
  • 1
    no worries, we all learn here. – Bichoy May 27 '15 at 7:28

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.