summaryrefslogtreecommitdiff
path: root/new_user_created.sh
blob: ff80c8066cfb33911620d1c817f9217eeef24195 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/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:"
	echo "ssh $user@$(hostname -f)"
	echo
else
	echo "Some error occurred, the account $user didn't get created, please go ask steering" >&2
	echo
	exit 1
fi