How to Give all the powers Of Root account to another user account? With full command and detail.


It's best to first look in /etc/sudoers for lines that look like:

## Allows people in group wheel to run all commands
%wheel  ALL=(ALL)       ALL

## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL

It's the "wheel" group on CentOS and "admin" on Ubuntu. If you are OK with giving this user all root powers, just make them a member of the group:

usermod -a -G wheel username

Or if you want to be more restrictive, add a line to give them more specific permissions:

username   ALL = (named) /usr/sbin/named

This lets username run /usr/sbin/named, but only as user named. In some distros, you can add this line to a new file /etc/sudoers.d/username so that your distro can upgrade the delivered base file without stomping on your edits.

Then, your user can run

sudo -u named /usr/sbin/named

in the more restrictive case, or in the former example

sudo make me-a-sandwich

to run a command as root. If you just want a shell as root,

sudo -s
  • On Ubuntu, it suffices to add the user to the sudo group. – reinierpost Jun 12 '15 at 7:54
  • @reinierpost However, this is RHEL, not ubuntu. – Jenny D Jun 12 '15 at 8:32
  • Sorry, I missed the tag. – reinierpost Jun 12 '15 at 11:39

Sudo should provide you with the most common way to do this. Any member of the wheel group will have sudo rights by default.

Putting it together you will want to add any user you want to have root privileges to the wheel group. They will then preface any command with sudo to run a command (and only that command) as root. At the end of the command they will be back to a regular user.


ls /root


sudo ls /root
  • 1
    Perhaps just add that to enable sudo for a user the user should be added to the sudo group – kos Jun 12 '15 at 2:04
  • 1
    It depends on which variety of Unix you're running. It varies between Linux distributions, for instance: Ubuntu has the sudo group, CentOS hasn't. – reinierpost Jun 12 '15 at 7:53
  • OP tagged this Red Hat. – user1794469 Jun 12 '15 at 12:39

If what you want is to mimic root but with another name, just create a new user and modify /etc/passwd. Set the 3rd and 4th fields to 0 and you will have another root user.

In the end being root is just having UID=0 which is what you did in the previous step.

  • 2
    True, but probably a bad idea. – reinierpost Jun 12 '15 at 7:55
  • Depends on what you want. It is your responsability. – YoMismo Jun 12 '15 at 7:58

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.