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
31 Answer
- 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/bashnewroot: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.