- start option for create users (-g) - delete user script - update documentation - user lock user script in check user flow output - create user has check for valid username/group name
44 lines
780 B
Bash
44 lines
780 B
Bash
#!/usr/bin/env bash
|
|
|
|
# Rename user
|
|
# - rename user name
|
|
# - rename home folder + owner
|
|
# - rename public key file in /etc/ssh/
|
|
|
|
TEST=0; # do not run any actions
|
|
GO=1; # without this flag the script will exit with an info box
|
|
BACKUP=1;
|
|
while getopts ":tih:" opt; do
|
|
case "${opt}" in
|
|
g|go)
|
|
GO=1;
|
|
;;
|
|
t|test)
|
|
TEST=1;
|
|
;;
|
|
\?)
|
|
echo -e "\n Option does not exist: ${OPTARG}\n";
|
|
echo "Use -t for test";
|
|
echo "Use -g for actually creation run";
|
|
exit 1;
|
|
;;
|
|
esac;
|
|
done;
|
|
shift "$((OPTIND-1))"
|
|
|
|
if [ $(whoami) != "root" ]; then
|
|
if [ ${TEST} -eq 0 ]; then
|
|
echo "Script must be run as root user";
|
|
exit;
|
|
else
|
|
echo "!!!! Script must be run as root user !!!!";
|
|
fi;
|
|
fi;
|
|
|
|
if [ $# -eq 0 ]; then
|
|
echo "Must give at least one user name";
|
|
exit;
|
|
fi;
|
|
|
|
# __END__
|