User Creation and Deletion and add them to sudoers and a custom linux user group

Add and remove a user on a linux server set the password and add them to the list of sudoers. 

 

The 'psaserv' group is for plesk so the user can have access to the plesk files


Author: Anonymous
Added: Wednesday, 21 May, 2014
Category: Terminal

Code

User Creation and Deletion

Adding users
To add a user to a linux server, set the password, add them to the psaserv group, and also add them to the list of sudoers use the following commands below.
$ useradd johndoe
$ passwd johndoe(input password twice)
$ vi /etc/group (add new user onto end of psaserv line
$ vi /etc/sudoers (add following below similar entries:)
johndoe ALL=(ALL) ALL

Removal
To remove a user called johndoe you can see if one exists by using cat, then delete the user, and use cat again to see if the user is removed.
$ cat /etc/passwd | grep -i johndoe
johndoe:x:10285:10285::/home/johndoe:/bin/bash
$ userdel johndoe
$ cat /etc/passwd | grep -i johndoe

Comments