VSFTPD, chroot, mount –bind & fstab

While I’m still setting up my new Fedora server, today’s task was getting an FTP server up and running.

I wanted the same kind of functionality with VSFTPD as I had with Serv-U on my old Windows Server but, as luck would have it, CHROOTing people effectively renders symbolic links totally useless. :(

The solution, as provided by ProFTPD’s user docs was to use:

mount --bind /home/folder /home/user/folder

to overcome the problem. The above command would create a mounted folder inside a user’s CHROOTed environment but to a folder that exists outside of it. ie. The user is CHROOTed in /home/user/ but the folder you want to give them access to is located elsewhere on the server, outside of their CHROOT. The solution works a treat and honours any security privileges set on the “real” folder too.

Great! Only problem there was that I need these mounts to persist between reboots so I needed to edit /etc/fstab. Unfortunately I know nothing about /etc/fstab so editing it was going to be fun. A quick Google dug up this helpful little tip. Hopefully it comes in handy for others!

In a nutshell, to see how a mount command should look when transposed in to fstab, simply type in the manual mount command then have a look at /etc/mtab using:

cat /etc/mtab

Lewis

This entry was posted in General. Bookmark the permalink.

2 Responses to VSFTPD, chroot, mount –bind & fstab

  1. Amar says:

    I am using vsftps 2.2.0 on Ubuntu 9.10. I want my external hard disk’s (NTFS) “Movies” folder (/meida/My Passport/Movies) to be accessible in “/srv/ftp/” i.e. from ftp:// in a browser.
    How to go about it?
    Mount? symlink? What to do?

  2. rixo says:

    Thanks a lot for sharing :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>