Multiple home directories

24 views
Skip to first unread message

Alessandro

unread,
Jan 4, 2012, 5:26:24 PM1/4/12
to Python FTP server library - Discussion group
Hi all,
I have overwritten few pyftpdlib classes in order to manage many
home directories per user, like samba shares folders.

Here an example:

authorizer = SharedAuthorizer()
authorizer.add_user(name, password, [
(dir1, "elr"),
(dir2, "elradfmw"),
.....
]
)
handler = ftpserver.FTPHandler
handler.authorizer = authorizer
handler.abstracted_fs = SharedFS
...


If someone is interested I can publish these few class (I have only to
decide if publish it "as is" (on pastebin, for example), or like a
stand-alone module to download and install).

PS: pyftpdlib is great!

Giampaolo Rodolà

unread,
Jan 4, 2012, 5:29:48 PM1/4/12
to pyft...@googlegroups.com

Ciao Alessandro,
I am interested. =)

> PS: pyftpdlib is great!

Thanks.

G.

Alessandro

unread,
Jan 5, 2012, 6:20:08 AM1/5/12
to Python FTP server library - Discussion group

> Ciao Alessandro,
> I am interested. =)


Here the two classes, and an example file

auth.py: http://pastebin.com/BUULZ272
fs.py: http://pastebin.com/uRARJyuH
server_example.py: http://pastebin.com/xXgQt0NS

I have thought that a stand-alone module is not a good idea, because
it has only two classes to be used as "tools" to extend pyftpdlib; too
few lines of codes! but a stand-alone project could help us to improve
ad debug it..

Tested with linux (server side) and filezilla client (win + linux).
Other clients seems give errors in some cases (ex. coreftp with spaces
in groups names)

I stopped development it when Filezilla started working. I didn't test
it very much, but it seems work.

There are many things to improve, to clear and comment the code, and
there are some features to be added like:
- give a name to a folder (like samba does); now the folder name is
the "last path name" (ex: /var/lib => "lib" is the name)
- permits to add annidate folder; now I can't add "/var/lib" and "/
var"
- in fs.py there are a spaces replacement for group names.. you can
avoid it, but I don't want to touch it too much in order to give you
the less "bugged" code as possibile. I don't know which could be the
best solution.
- lstat = stat in in fs.py

Enjoy! :-)
Reply all
Reply to author
Forward
0 new messages