mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
Add posixAccount class for LDAP users.
This commit is contained in:
parent
1f2dc5e730
commit
d672e24ac4
@ -30,6 +30,25 @@ cn: $username
|
|||||||
userPassword: $password
|
userPassword: $password
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
uid_num=$(getent passwd | awk -F: '($3>=1000) && ($3<59999) && ($3>maxuid) { maxuid=$3; } END { print maxuid+1; }')
|
||||||
|
home_dir=/home/$username
|
||||||
|
|
||||||
|
cat <<EOF |ldapmodify -Y EXTERNAL -H ldapi:///
|
||||||
|
dn: uid=$username,ou=users,dc=thisbox
|
||||||
|
changeType: modify
|
||||||
|
add: objectClass
|
||||||
|
objectClass: posixAccount
|
||||||
|
-
|
||||||
|
add: uidNumber
|
||||||
|
uidNumber: $uid_num
|
||||||
|
-
|
||||||
|
add: gidNumber
|
||||||
|
gidNumber: $uid_num
|
||||||
|
-
|
||||||
|
add: homeDirectory
|
||||||
|
homeDirectory: $home_dir
|
||||||
|
EOF
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to create user"
|
echo "Failed to create user"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user