diff options
Diffstat (limited to 'new_user_created.sh')
| -rwxr-xr-x | new_user_created.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/new_user_created.sh b/new_user_created.sh new file mode 100755 index 0000000..4328d47 --- /dev/null +++ b/new_user_created.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +read method type key <$SSH_USER_AUTH +user="$(grep -l -s -r -P '^\s*auth:\s*\Q'"$type"'\E\s+\Q'"$key"'\E$' /opt/autopeer/dn42-registry/data/mntner/ | perl -ne 's@^.*/@@; s@-MNT$@@; print lc;' | head -1)" + +if getent passwd "$user" >/dev/null 2>&1; then + echo "Your account has been created, go ahead and log in: shh $user@$(hostname -f)" +else + echo "An error occurred, the account $user didn't get created, please go ask steering" >&2 + exit 1 +fi |
