Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create a new Linux User w/ default SSH files
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
You can’t perform that action at this time.