Created
January 29, 2019 05:33
-
-
Save evitolins/f856ebb54274fc4117b5c50e13ed2d8a to your computer and use it in GitHub Desktop.
Create a new Linux User w/ default SSH files
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
NEWUSER="my_new_user" | |
sudo mkdir -p /home/${NEWUSER}/.ssh && \ | |
sudo touch /home/${NEWUSER}/.ssh/authorized_keys && \ | |
sudo useradd -d /home/${NEWUSER} ${NEWUSER} && \ | |
sudo usermod -aG sudo ${NEWUSER} && \ | |
sudo chown -R ${NEWUSER}:${NEWUSER} /home/${NEWUSER}/ && \ | |
sudo chown root:root /home/${NEWUSER} && \ | |
sudo chmod 700 /home/${NEWUSER}/.ssh && \ | |
sudo chmod 644 /home/${NEWUSER}/.ssh/authorized_keys | |
sudo passwd ${NEWUSER} | |
ssh-keygen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment