Created
January 6, 2025 04:32
-
-
Save jmkim/6dca7b94be55ebcf6c19669e399e5b3a to your computer and use it in GitHub Desktop.
LDAP shell modifier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TITLE="LDAP shell modifier" | |
DESCRIPTION="LDAP shell modifier" | |
VERSION="1.0" | |
AUTHOR="Jongmin Kim <[email protected]>" | |
LICENSE="Expat" | |
EXECUTABLE="$0" | |
ADMIN_DN='uid=jmkim,cn=users,dc=doubleo,dc=co,dc=kr' | |
USER_DN="uid=$1,cn=users,dc=doubleo,dc=co,dc=kr" | |
USER_SHELL="$2" | |
LDIF_TEXT="dn: $USER_DN | |
changetype: modify | |
replace: loginShell | |
loginShell: $USER_SHELL" | |
if [[ "$#" -ne 2 ]]; then | |
echo "Usage: $EXECUTABLE [uid] [shell]" | |
exit 1 | |
fi | |
echo "--" | |
echo "$LDIF_TEXT" | |
echo "--" | |
ldapmodify -D "$ADMIN_DN" -W <<EOM | |
$LDIF_TEXT | |
EOM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment