Automatic mapping between LDAP users and local users

Post here if you have some suggestions or you want to request a new feature.

Automatic mapping between LDAP users and local users

Postby fred9176 » Fri Feb 15, 2013 7:48 am


Would it be possible to add an automatic mapping between ldap accounts and local accounts ?

Actually, we have to create a local user for each ldap user with a different name and map every user in the authentication ldap tab.

We could use a specific prefix or suffix to automaticcaly map users.
For example, if my ldap user is j.doe, we could create a local user called j.doe-local (or ldap_j.doe, ...) and WingFTp should automaticaly know that the 2 users are linked.


posts 23
joined Mon Jul 02, 2012 9:29 am

Re: Automatic mapping between LDAP users and local users

Postby FTP » Mon Feb 18, 2013 12:50 pm

OK, I will give you a Lua script for creating a local user and adding AD-to-Local mapping automatically,

You can add the following script into "Event Manager -> FTP Events (HTTP Events and SSH Events) -> OnUserLoggedIn -> Lua Script":

Code: Select all
local strDomain = "%Domain"
local strRootDir = "c:/temp"
local strADUser = "%Name"
local strLocalUser = "local_".."%Name"
local strMapping = c_GetOptionStr(strDomain,DOPTION_ADUSER_MAPPING_STR)

if not string.find(strMapping, "%Name"..":") then
   if c_UserExist(strDomain,strLocalUser) == false then
      local strPassword = md5( (c_GetTimeUS() + c_GetRandom())..c_GetServerID().."mypassword" )
      c_AddUser(strDomain,strLocalUser, strPassword, 63, 1, 1)
      c_AddUserDirectory(strDomain,strLocalUser, strRootDir.."/"..strADUser, "/", true, true, true, true, true, true, false, false, false, true, false, false)
Site Admin
posts 1414
joined Tue Sep 29, 2009 6:09 am

Return to Suggestions & Wishlist

Who is online

Users browsing this forum: No registered users and 1 guest