How to bind directory in Linux
Have you ever been getting problem regarding chroot aka Change Root? Change root is a great solution to create a jail for such a process, users or services to maximize level of security concern. The most common usage of Change Root is for FTP server. However, it is not perfect in some cases. For example, you are going to provide a file server for mirroring through FTP. Unfortunately, you don't have SAN or NAS to serve large storage, says 1 TB or more, on a single directory (a partition). There are several solutions, e.g., parallel file system and friends. Another solution with less complexity is to bind directory locally.
What is it? Binding directory is a feature of Linux to mount a local directory to appear as another directory sharing the same content. For example, FTP server usually creates a jail in /var/ftp
. However, it is not a good thing to mount the disk directly in that directory. Instead, the volume is mounted at /mnt/data
. Then that directory are binded to /var/ftp/pub/data
.
mount --bind /mnt/data /var/ftp/pub/data
To automatically bind, just add below lines in /etc/fstab
.
/mnt/data /var/ftp/pub/data none bind
- sugree's blog
- 1844 reads
Post new comment