PDA

View Full Version : [Solved] How to add new user with root permissions in Linux



Fli
09-24-2017, 04:19 PM
Hello,

what is the most simple way to add new Linux user with root/sudoers permissions/rights?

NEW METHOD:

adduser user --gecos GECOS && usermod -aG sudo user

Switch to new user: su user; cd

OLD METHOD:

Login as root

adduser newusername
passwd newusername

# visudo
copy line: root ALL=(ALL) ALL
and paste it below that line and modify username so it look like this:

root ALL=(ALL) ALL
newusername ALL=(ALL) ALL

type: :wq

hit enter

# exit

login as new user: ssh newusername@IP

to run root commands under newusername, add "sudo" before the command and use your "newusername" password as a confirmation.

AlexCross
10-19-2020, 08:10 AM
login as new user: ssh newusername@IP