Restricting FTP users

From rbachwiki
Jump to navigation Jump to search

Restricting FTP users to their Home Dir

This is done using an 'ftpchroot' file, which makes each listed user's home directory appear as the root of the system via FTP, so there's no way they can move "up" out of their directories.


This only works for users who exist as users on your system. You may want to create a generic 'ftpuser' for such purposes. For this example, we'll assume you have two users, 'tom' and 'ftpuser', and you'd like to restrict both of them to their home directories. Open a terminal and type cd /etc to change into the 'etc' directory.

We'll use pico as the text editor, since this is a very simple file. Type sudo pico ftpchroot and enter your normal admin user's password when prompted.

When the file opens, simply type each user's short name on a line of its own: ftpuser tom Save the file by typing Control-X. That's it! You've created the file you need to restrict FTP users' access.

To implement the file, you will probably have to restart your network -- you could try disabling and re-enabling FTP from the Sharing prefs panel, but a full restart will definitely do the trick! If you ever need to add more users, just follow these directions and add additional rows for each new user you wish to restrict.