Limit access to particular directory for ftp user

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?

2 Replies

FTP is not recommended these days, it's insecure both on the server side and with the actual connection. Instead, i recommend you look into sftp and this guide will help with that

http://library.linode.com/security/sftp-jails

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

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct