Managing users on Linux

Managing Linux users

Managing users on Linux

Add a user

useradd -m klagan

or if you want to add the new user to the sudo group and default the shell to bash

useradd -G sudo -m lagan -s /bin/bash

Check defaults for new user

useradd -D

Change prompt


Add groups to user


sudo usermod -a -G <groups> <username>

Administering user access with SSH

Create a user

sudo adduser <username>

Create a password for the user

sudo passwd <username>

Become the new user

sudo su - <username>

Create a new set of assymetric keys for SSH access

You can follow the instructions here

Set up the SSH access for the new user

mkdir .ssh
chmod 700 .ssh
touch .ssh/authorized_keys
chmod 600 .ssh/authorized_keys

Paste your public key in the .ssh/authorized_keys file and save the file
Share the private key with user