User creation scripts for aws servers

This commit is contained in:
Clemens Schwaighofer
2021-12-14 06:50:13 +09:00
commit 95451f2e46
3 changed files with 338 additions and 0 deletions

19
user_zip.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
root_folder=$(pwd)'/';
if [ ! command -v zip &> /dev/null ]; then
echo "Missing zip application, aborting";
exit;
fi;
# arg 1 must be valid path to where we store the zip file
if [ ! -d "${1}" ]; then
echo "${1} is not a valid path";
exit;
fi;
# zip key folder, user list, user password into users.zip
echo "Zipping data to: ${1}/users.zip"
$(cd "${root_folder}"; zip -FSr "${1}/users.zip" "user_list.txt" "user_password.txt" "ssh-keygen/");
echo "Data zipped";