diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-04-15 10:33:24 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-04-15 10:33:24 +0200 |
commit | 1ffa25152f18588b381fa9260f437f07d9a04003 (patch) | |
tree | 99b688314ca245b80185798e12f1e3450eb2a667 /skripti/registracija_uporabnika.sh | |
parent | dn05p2 (diff) | |
download | r-1ffa25152f18588b381fa9260f437f07d9a04003.tar r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.gz r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.bz2 r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.lz r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.xz r-1ffa25152f18588b381fa9260f437f07d9a04003.tar.zst r-1ffa25152f18588b381fa9260f437f07d9a04003.zip |
Diffstat (limited to '')
-rwxr-xr-x | skripti/registracija_uporabnika.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/skripti/registracija_uporabnika.sh b/skripti/registracija_uporabnika.sh new file mode 100755 index 0000000..a2419fa --- /dev/null +++ b/skripti/registracija_uporabnika.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# $1 je username, $2 je fullname, $3 je komentar, $4 je expiredate YYYY-MM-DD, $5 je groups, $6 je crypt password +# GECOS: full name,room number,office tel,home tel,other contact +set -euo pipefail +username=`grep -o "[a-z][-_.a-z0-9]*" <<<"$1" | head -n1 | head -c16` +if [ ! "$username" = "$1" ] +then + echo uporabniško ime ni pravilne oblike. predlagam takole uporabniško ime: $username -- uporabnika nisem izdelal + exit 1 +fi +useradd --expiredate "$4" --groups "$5" --password "$6" --comment "`sed -e s/,//g<<<$2`,,,,`sed -e s/,//<<<$3`-reg.sh $DOAS_USER `date +%s`" $username +echo uporabnik uspešno izdelan! |