Runbook:Useradd
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.
This article is issued from Old-wiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.