Tuesday, June 22, 2010

Linux SFTP - Link Directories Using a Chroot Jail

Sometimes I have an FTP/SFTP server (or any other Chroot directory) and need to give access to a folder outside of the user's "jail". To do this you can simply grant the proper permissions and mount the other directory. Below are the (very) brief instructions.
  • Grant the user (we will call them the 'reader') the appropriate permissions (maybe 755) to the folder that you want to mount in their chroot'd directory
  • Then mount the directory (mount /directory/to/read /home/of/reader)
Although this seems petty, it is frustrating when you don't know how to do it. I use this most often when I am granting read-only permissions to an SFTP directory for a single user.

NOTE: If you are using this for FTP/SFTP and receive a permission denied error when logging in, check the permissions on the folder. I usually need to set 755 for this to work properly.

1 comment:

Sergej said...

Can I grant r/w permissions with this tool?