Last active
December 16, 2019 20:17
-
-
Save fawkesley/d53180d1de8b18b8383750f785937084 to your computer and use it in GitHub Desktop.
SSH user / authorized keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export NEW_USER=exampleuser | |
export NEW_HOME=/home/$NEW_USER | |
sudo useradd $NEW_USER \ | |
--home $NEW_HOME \ | |
--create-home \ | |
--shell /bin/bash \ | |
--groups ssh | |
sudo passwd $NEW_USER | |
sudo mkdir -p ${NEW_HOME}/.ssh | |
sudo touch ${NEW_HOME}/.ssh/authorized_keys | |
# now populate ${NEW_HOME}/.ssh/authorized_keys | |
sudo chown -R ${NEW_USER} ${NEW_HOME}/.ssh | |
sudo chmod 700 ${NEW_HOME} ${NEW_HOME}/.ssh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment