Runbook:Useradd

From SoMakeIt
Jump to: navigation, search


To add users to a linux system if you know their public key:

# Add the user
useradd -m -G <groups> <name>  # probably use the same groups you have

# Now set up ~/.ssh/authorized_keys, get the directory permissions right
sudo su - <name>
ssh-keygen && rm .ssh/id-rsa .ssh/id-rsa.pub
vi .ssh/authorized_keys

# Make it so they set a password on login
chage -d 0 <name>  # sets the password to expired so they have to set it on login
passwd -d <name>  # set the password to deleted so they can set one without knowing the existing one, which does not exist

Now when the user first logs in using the key they will be forced to set a new password, and then will be able to use sudo.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox
Donate