ProFTPD and Microsoft Active Directory authentication

After a lot of searching and banging my head against the wall, I finally found a solution on how to authenticate users logging into a ProFTPD server using Mircosoft AD. I'm using ProFTPD version 1.3.4rc2 with these configurations. I'm not going to post the main config file as I assume you have got a working installation of ProFTPD  and you just miss the AD authentication bit. This setup was made so that users could upload web pages to a server and have the automaticly published using a Apache server.

ldap.conf
<IfModule mod_ldap.c>
# Connection information
LDAPServer ldap://dc01.domain.com/??sub
LDAPAttr uid sAMAccountName
LDAPAuthBinds on

# User information
LDAPBindDN "cn=UserWithBindRights,cn=users,dc=domain,dc=com" "PasswordForUserWithBindRights"
LDAPUsers OU=OuThatYouWantToSearchIn,dc=domain,dc=com (sAMAccountName=%u)

# ID's to use when not using the ones from AD
LDAPDefaultGID    1111
LDAPDefaultUID    1111

# Override the use of AD id's with the default values set.
# Handy when using this setup with a web server that needs read and write
# access to the files and directories uploaded.
LDAPForceDefaultGID on
LDAPForceDefaultUID on

# Switch on the functionality to generate user homes.
LDAPGenerateHomedir on 0775
CreateHome on 0775
# Overide homedir values from AD
LDAPGenerateHomedirPrefix /place/to/generate/user/homes
LDAPForceGeneratedHomedir on

</IfModule>

It's really important to add the ??sub after the server address. If you don't ProFTPD will use ??base instead and you will not get any results when searching AD. Remember to adjust the values before using this config.

Also you might want to note that the home directory that gets made using the username from AD and not the ones provided from the user, so if the username in AD is capitalized so will the homedir be. Will post a solution on how to fix this as well for the ones that require it.

2 comments:

  1. Thank you! It was helpful for me today!
    Have a nice day!

    ReplyDelete
  2. Thanks to you I didn't bang my head on the wall ! Thank you very much

    ReplyDelete