New User With Root Access and Without Sudo
9,849
- It is recommended not to use another user as root and just use sudo permissions.
- You can simply add user by
sudo adduser <username>
. - 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
- Look for the user you created and change the uid and gid to the same as root gid and uid.
- 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.
- I AM SAYING AGAIN IT IS NOT RECOMMENDED TO PUT ANOTHER USER AS ROOT
- you can get the same permissions by using sudo command.
- 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.
Related videos on Youtube
Author by
Ven Ven
Updated on September 18, 2022Comments
-
Ven Ven over 1 year
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
-
Soren A over 3 yearsIf you know about the security risks, then why do it. There are (almost) never a reason to be permanently logged in with root-rights.
-
Ven Ven over 3 yearsif you use virtualbox you will understand :)
-
Soren A over 3 yearsI have used VirtualBox .. I still don't understand. Please explain.
-
-
Ven Ven over 3 yearsThe system does not recoginize the new user and it think that it is the root user .. is there a way around that ?
-
Ven Ven over 3 yearswhat about groups for example ? can I add the new user to the root group
-
Ven Ven over 3 yearsnot helpful about what I asked you :(
-
johncli over 3 yearstry to change the gid and uid on the /etc/passwd without changing the path that will work out, (i just did on my ubuntu)
-
Admin almost 2 yearswhat if I'm running a service as root and wanted to drop permissions ?