mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +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
|
||||
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
|
||||
echo "Failed to create user"
|
||||
exit 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user