Home Directory

Please post here if you have problems in using Wing FTP Server.

Home Directory

Postby aqxavier » Wed Aug 11, 2010 7:09 pm

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
aqxavier
 
posts 4
 
joined Wed Aug 11, 2010 7:00 pm

Re: Home Directory

Postby FTP » Wed Aug 11, 2010 7:21 pm

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)
FTP
Site Admin
 
posts 1243
 
joined Tue Sep 29, 2009 6:09 am

Re: Home Directory

Postby aqxavier » Fri Aug 13, 2010 3:05 pm

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?
aqxavier
 
posts 4
 
joined Wed Aug 11, 2010 7:00 pm

Re: Home Directory

Postby FTP » Fri Aug 13, 2010 3:21 pm

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)
FTP
Site Admin
 
posts 1243
 
joined Tue Sep 29, 2009 6:09 am

Re: Home Directory

Postby maxvhm » Mon Mar 21, 2011 3:09 pm

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)
maxvhm
 
posts 1
 
joined Mon Mar 21, 2011 3:06 pm

Re: Home Directory

Postby FTP » Tue Mar 22, 2011 4:56 am

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
FTP
Site Admin
 
posts 1243
 
joined Tue Sep 29, 2009 6:09 am


Return to Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 1 guest