Page 1 of 1
Home Directory
Posted: Wed Aug 11, 2010 7:09 pm
by aqxavier
Hi,
How to configure the Wing FTP Server when he created a user to automatically create a folder for the user based on login?
This is possible when changing the authentication to Windows authentication, but use Linux. : (
Thks
Alexandre
Re: Home Directory
Posted: Wed Aug 11, 2010 7:21 pm
by FTP
Yes, Linux can't use Windows authentication. But you can create a home directory for specified user when he logged in. Just write some Lua script in the Event "OnUserLoggedIn", like this:
Code: Select all
local newfolder = "/tmp/mydata/".."%Name"
c_MkDir(newfolder)
c_AddUserDirectory("%Domain","%Name",newfolder ,'/',true,true,false,false,false,true,false,false,false)
Re: Home Directory
Posted: Fri Aug 13, 2010 3:05 pm
by aqxavier
Hi Admin
Thank you for the code ..
It worked perfectly ... The system created the folder of the user.
But when it creates the folder does not have permission to send files, because the system creates when he attributes to the directory 755 and not 666.
I was looking for documentation of mkdir and found nothing to assign rights.
How can I solve?
Re: Home Directory
Posted: Fri Aug 13, 2010 3:21 pm
by FTP
not c_MkDir(), please check out c_AddUserDirectory(), change it like this:
c_AddUserDirectory("%Domain","%Name",newfolder ,'/',true,true,true,false,false,true,false,false,false)
Re: Home Directory
Posted: Mon Mar 21, 2011 3:09 pm
by maxvhm
I have a problem with this script.
Every time the user is login in, an additional line is created in the directory permissions with the same permission levels.
OS win2008 R2 64bit
Wing FTP 3.8 (trial)
Re: Home Directory
Posted: Tue Mar 22, 2011 4:56 am
by FTP
OK, please judge whether exists a home directory first, like this:
if table.maxn(c_GetUser("%Domain","%Name").directories) == 0 then
c_AddUserDirectory("%Domain","%Name",newfolder ,'/',true,true,true,false,false,true,false,false,false)
end