modification on settings-file WITHOUT lua

Please post here if you have problems in using Wing FTP Server.
Post Reply
cheese
Posts: 1
Joined: Mon Jun 18, 2012 7:08 am

modification on settings-file WITHOUT lua

Post by cheese »

i would like to modify wftpserver/Data/settings.xml and wftpserver/Data/DOMAIN/settings.xml and wftpserver/Data/DOMAIN/users/USERNAME.xml outside of wftpserver and without using lua.

does the server check and recognise that those files have changed and reload them or would i need to restart the server after such modifications? or is there any lua-script to trigger that reread of configuration files without disconnecting active sessions.

thanks
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: modification on settings-file WITHOUT lua

Post by FTP »

Please do not modify the setting files directly, you can change the server settings or the user settings via web admin (or Lua WebService).
Oniqua
Posts: 1
Joined: Mon May 27, 2013 4:45 am

Re: modification on settings-file WITHOUT lua

Post by Oniqua »

How do we change the AD mapping then? I cannot find any command in the Lua API to influence this setting. This is required for us to map new AD users automatically using the XML method

The XML tag we want to read and write to is

<ADUser_User_Mapping>
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: modification on settings-file WITHOUT lua

Post by FTP »

Do you need a Lua script to map the AD user to the local user automatically (also create a local user account)? So just add the following Lua 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 strPrivateDir = strRootDir.."/"..strADUser
local strPublicDir = "c:/pub"
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() + 123)..c_GetServerID() )
		c_AddUser(strDomain,strLocalUser, strPassword, 63, 1, 1)
		c_MkDir(strPrivateDir)
		c_AddUserDirectory(strDomain,strLocalUser, strPrivateDir, "/", true, true, true, true, true, true, false, false, false, true, false, false)
		c_AddUserDirectory(strDomain,strLocalUser, strPublicDir, "public", false, true, true, true, false, true, false, false, false, false, false, false)
	end
	c_SetOptionStr(strDomain,DOPTION_ADUSER_MAPPING_STR,strMapping.."\r\n"..strADUser..":"..strLocalUser)
end
Post Reply