Jail Linux user to directory for FTP login

Posted by Greg on Server Fault See other posts from Server Fault or by Greg
Published on 2011-02-01T14:06:32Z Indexed on 2011/02/01 15:27 UTC
Read the original article Hit count: 299

Filed under:
|
|
|
|

I'm planning on using vsftpd to act as a secure ftp server, but I am having difficulty controlling the linux users that will be used as ftp logins.

The users are required to be "jailed" into a specific directory (and subdirectories) and have full read/write access.

Requirements: - User account "admin_ftp" should be jailed to /var/www directory. - Other accounts will be added as needed, for each site... e.g: - User account "picturegallery_ftp" should be jailed to /var/www/picturegallery.com directory.

I have tried the following, but to no avail:

# Group to store all ftp accounts in.
groupadd ftp_accounts
# Group for single user, with the same name as the username.
groupadd admin_ftp

useradd -g admin_ftp -G ftp_accounts admin_ftp
chgrp -R ftp_accounts /var/www
chmod -R g+w /var/www

When I log into FTP using account admin_ftp, I am given the error message:

500 OOPS: cannot change directory:/home/admin_ftp

But didn't I specify the home directory?

Extra internets for a guide how to do this specifically for vsftpd :)

© Server Fault or respective owner

Related posts about linux

Related posts about ftp