Bind Mount Directories
Bind-mounts are more robust than symlinks, especially when dealing with directories on removable storage: they use time-tested failsafe mounting techniques. Bind-mounted directories can also provide special permissions to users that differ from the source directory.
For example, let's say that you want to link a folder on the external USB hard drive to vsftpd's /var/ftp/pub
folder.
First, create the source folder on the external hard drive:
sudo mkdir /media/usbdisk/ftp
Next, (if necessary), create the destination folder on the system:
sudo mkdir /var/ftp/pub
After that, (if necessary) give the target user permissions over this specific directory. In this example, the target user is
ftp
, in groupftp
. If you don't need to run programs from this folder, use644
. If you do, use755
.sudo chown ftp:ftp /media/usbdisk sudo chmod 644 /media/usbdisk
Finally, add this bind mount entry to the
/etc/fstab
, so it will be mounted on boot every time./media/usbdisk/ftp /var/ftp/pub none bind 0 0
- Source: Backdrift - How to use Bind-Mounts in Linux
- Source: Ducea - Allowing FTP Access to files outside the home directory chroot
- Source: G-Loaded.eu - Set up an anonymous FTP server with vsftpd in less than a minute http://www.g-loaded.eu/2008/12/02/set-up-an-anonymous-ftp-server-with-vsftpd-in-less-than-a-minute/)
- Source: Man and Keyboard - Owncloud and an External Hard Drive