Linux - Create a new root user

Existing user, the decent way:
sudo usermod -a -G sudo username

Yes you can create another account who will have the same power as root user,
Use the command ,

useradd -ou 0 newrootuser
passwd newrootuser

After this user(newrootuser) will work as root user


Create additional root-level accounts by running these commands from a terminal session:

sudo su newrootuser
useradd -G root newrootuser
passwd newrootuser
id
(you should see something similar to: uid=1001(newusername) gid=1001(newusername) groups=0(root)
usermod username -o -u 0 -g 0
(in the usermod command string, the first switch is the letter “O”. The characters following the -u and -g switches are each “zero”)
id
(now you should see something similar to: uid=0(root) gid=0(root) groups=0(root)


ubuntu - add new user with root access in Linux - Server Fault

adduser -u 0 -g root -G root -s /bin/bash -r USERNAME -p 123456

ubuntu - add new user with root access in Linux - Server Fault

You can edit the /etc/passwd file and change the user account ID from whatever number it is, to 0. That's right, zero.

username:x:0:502::/home/username:/bin/bash

 

No Comments

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *