Limit access to particular directory for ftp user
2 Replies
Change the chrootdirectory option to whatever you need also or just add the user with their homedir set to whatever directory they should have under /srv/www
@marko_roi:
I would like to limit a certain user to access only to one directory in srv/www. So he can only access this directory over FTP? How to do that?
I use vsftpd, and if you set up per-user configuration files, you can set a per-user root for any FTP transfers.
In the main vsftpd.conf, set "userconfigdir" to a directory holding files named for each user. You can then put any configuration entries you want into those per user files. In my case, I use "local_root" in each file to establish the top of the filesystem tree that user can access (my case sounds similar to yours in that it's the root of their specific sub-tree under a staging web site).
Using vsftpd also permits virtual users, where vsftpd has it's own passwd file. If combined with guestenable/guestusername, you can have an arbitrary number of individual FTP accounts, all of which eventually map to the same filesystem user within the web tree, simplifying access from the web server user, and without having to create actual accounts on the system outside FTP transfers.
– David