-
-
Save nils-wagner-signavio/83e6e4bbfe422bbf5e4fd76839270dcb to your computer and use it in GitHub Desktop.
Revisions
-
nils-wagner-signavio revised this gist
May 13, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ users="${@:-nwagner}" # normally users group="users" # normally adm and/or sudo groups="adm,sudo" for user in ${users}; do -
nils-wagner-signavio created this gist
May 13, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #! /usr/bin/env bash # normally first char of prename + surname users="${@:-nwagner}" # normally users group="users" # normally adm and or sudo groups="adm,sudo" for user in ${users}; do auth_keys_file=/home/${user}/.ssh/authorized_keys echo "Creating access for user: ${user}" useradd -s /bin/bash -m ${user} -g ${group} -G ${groups} -c "manually created on $(date +%Y%m%d-%H%M%S)" mkdir -m 0700 /home/${user}/.ssh [ -f "${auth_keys_file}" ] || install -b -m 0600 /dev/null ${auth_keys_file} echo "Paste user's SSH pub key here, make sure to end with new line and press CTRL+D to exit" echo ${auth_keys_file} cat >>${auth_keys_file} echo "SSH pub key stored in ${auth_keys_file}" chown -R ${user}:${group} $(dirname ${auth_keys_file}) echo -e "... User '${user}' done\n" done