Kevin's Worklog

Documenting the Daily Stream

Creating New Linux Users

This is something very basic but I, not being a sysadmin, so rarely do it that I thought I’d document it.

To add a new user:

sudo adduser --home /home/ksclarke --shell /bin/bash --groups wheel,apache,users ksclarke

To remove that user (including their home directory):

sudo userdel -r ksclarke

Lastly, you might want to add that user’s public key to their authorized keys list (using nano to copy and paste it in):

sudo mkdir /home/ksclarke/.ssh
sudo nano /home/ksclarke/.ssh/authorized_keys
sudo chown -R ksclarke:ksclarke /home/ksclarke/.ssh
sudo chmod 700 /home/ksclarke/.ssh
sudo chmod 600 /home/ksclarke/.ssh/authorized_keys