Created
December 20, 2019 05:00
-
-
Save michilu/931d636c143b5af612aaf44fbc45ad28 to your computer and use it in GitHub Desktop.
create_user.sh
This file contains 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
#!/bin/bash | |
set -o errexit | |
set -o xtrace | |
set -o nounset | |
USER=$1 | |
id $USER\ | |
&& userdel -r $USER | |
useradd -m -s /bin/bash -g operator --password $USER $USER | |
mkdir -p /home/${USER}/.ssh | |
cd /home/${USER} | |
touch .ssh/authorized_keys | |
curl https://github.com/${USER}.keys > .ssh/authorized_keys | |
chmod 700 .ssh | |
chmod 600 .ssh/authorized_keys | |
chown -R ${USER}:operator .ssh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment