New User With Root Access and Without Sudo

I Know about the security risk and I know about sudo, sudo su, sudo -i and the sudoers file but what I need is to create a new user (not root user) with the root privilage without having to use sudo at all. how to do that ? and don't give me an altrnative ways please thank you

3

1 Answer

  1. It is recommended not to use another user as root and just use sudo permissions.
  2. You can simply add user by sudo adduser <username>.
  3. You can change the uid and gid to root uid and gid by using sudo nano /etc/passwd
    • you will see users at the same syntax as this example:
    • root:!:0:0::/:/usr/bin/bash
    • newroot:x:1001:1002:,,,:/home/newroot:/bin/bash
    • change your new user uid and gid to the same as root newroot:x:0:0:,,,:/home/newroot:/bin/bash
  4. Look for the user you created and change the uid and gid to the same as root gid and uid.
  5. To look what the uid and gid of the root you can just look in the same file at the root user or use the command id root.
    • on the most of the distributions the uid and gid of the root is 0.
  6. I AM SAYING AGAIN IT IS NOT RECOMMENDED TO PUT ANOTHER USER AS ROOT
    • you can get the same permissions by using sudo command.
  7. To give you new user the sudo permissions wich is recommended then the first part on my answer you can simply make it by:
    • sudo useradd <NEWUSER>
    • sudo usermod -a -G sudo <NEWUSERNAME>
    • the -a for not overwriting and deleting the "old" groups of the user.
5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like