Send your FTP users to jail

June 4, 2010 — Mike Hommé
Mike Hommé's picture

To preface, I'm running Red Hat Enterprise Linux and assume you have nano installed. If not vi will work just fine.

Also using PuTTY to access my Linux server from a Windows host.

So, to jail folks up we've taken this approach which I think is pretty straight forward and easy.

1. Open a terminal and type:

nano /etc/passwd

2. Make two changes:

Set the user's home directory to whatever the home directory is for the website they work on:
/var/www/html/website_name
Set their login shell to /sbin/nologin

Save it with a Ctrl+x, hit the "y" key, then Enter to confirm.

To finish up, you must add their login name to the /etc/vsftpd/chroot_list.

After that, again, save the file using the instructions above.

That'll keep them to their own and restrict access to other levels of the server.

Done.

Got a better way to do it? Let me know!