Home Directory

Please post here if you have problems in using Wing FTP Server.
Post Reply
aqxavier
Posts: 4
Joined: Wed Aug 11, 2010 7:00 pm

Home Directory

Post 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
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Home Directory

Post 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)
aqxavier
Posts: 4
Joined: Wed Aug 11, 2010 7:00 pm

Re: Home Directory

Post 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?
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Home Directory

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

Re: Home Directory

Post 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)
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Home Directory

Post 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
Post Reply