Adjustments to support workstation mode

This commit is contained in:
2026-02-27 14:30:51 -05:00
parent 6dbb650431
commit 77a250ce08
14 changed files with 93 additions and 73 deletions

View File

@@ -0,0 +1,21 @@
#!/bin/bash
# cloneuser
SRC=$1
DEST=$2
SRC_GROUPS=`id -Gn ${SRC}`
SRC_SHELL=$(awk -F : -v name=${SRC} '(name == $1) { print $7 }' /etc/passwd)
RAND_PW=`date +%s | sha256sum | base64 | head -c 32 ; echo`
echo "Creating user $DEST"
useradd --shell ${SRC_SHELL} --password ${RAND_PW} --create-home ${DEST}
for grp in ${SRC_GROUPS};do
if [ "$grp" != "$SRC" ]; then
echo "Adding user $DEST to group $grp."
usermod -a -G $grp ${DEST}
fi
done