48 lines
1010 B
Bash
Executable File
48 lines
1010 B
Bash
Executable File
#!/bin/bash
|
|
#% raw-add-user login "Full Name" "email"
|
|
#% INTERNAL add user
|
|
|
|
. $LIB_DIR/common.sh
|
|
login="$1"
|
|
cn="$2"
|
|
email="$3"
|
|
idnumber=$(( `maxuid` + 1))
|
|
gecos=`sed -e "y/ąćęłńóśźżĄĆĘŁŃÓŚŹŻ/acelnoszzACELNOSZZ/" <<<"$cn"`
|
|
read -r gn sn <<<"$cn"
|
|
|
|
|
|
tag-begin "Adding user $login"
|
|
push <<EOF
|
|
dn: uid=$login,ou=People,dc=hackerspace,dc=pl
|
|
changeType: add
|
|
objectClass: inetLocalMailRecipient
|
|
objectClass: person
|
|
objectClass: organizationalPerson
|
|
objectClass: inetOrgPerson
|
|
objectClass: posixAccount
|
|
objectClass: top
|
|
objectClass: shadowAccount
|
|
objectClass: ldapPublicKey
|
|
objectClass: hsMember
|
|
shadowLastChange: 15022
|
|
shadowMax: 99999
|
|
shadowWarning: 7
|
|
loginShell: /bin/false
|
|
uidNumber: $idnumber
|
|
gidNumber: $idnumber
|
|
homeDirectory: /home/$login
|
|
cn: $cn
|
|
gecos: $gecos
|
|
givenName: $gn
|
|
surname: $sn
|
|
uid: $login
|
|
mail: $email
|
|
mailRoutingAddress: $email
|
|
userPassword: {crypt}x
|
|
userPassword: {SASL}$login@HACKERSPACE.PL
|
|
mailHost: hackerspace.pl
|
|
|
|
EOF
|
|
tag-end
|
|
msg "Don't forget to set a password for $login."
|