Page 1 of 1

modification on settings-file WITHOUT lua

Posted: Mon Jun 18, 2012 7:21 am
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

Re: modification on settings-file WITHOUT lua

Posted: Tue Jun 19, 2012 7:54 am
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).

Re: modification on settings-file WITHOUT lua

Posted: Mon May 27, 2013 4:47 am
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>

Re: modification on settings-file WITHOUT lua

Posted: Mon May 27, 2013 8:29 am
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