You can use the
bind mount option to map/remount an already mounted part of a file system hierarchy to somewhere else. Say you have a samba share with Videos and a second with an Image library and you want to offer those as a read only FTP downloads.
mkdir -p /var/ftp/Videos /var/ftp/Images
mount --bind /share/Videos /var/ftp/Videos
mount --bind /share/Images /var/ftp/Images
Then make those file systems read-only:
mount -o remount,ro /var/ftp/Videos
mount -o remount,ro /var/ftp/Images
The file system permissions remain unaltered, but everything under Videos and Images is now read-only. So it is unlikely that a sub-directory with
drwx------ can be accessed by the FTP user, but neither can the FTP user write to in a sub-directory with
The bind mount doesn't take options so to achieve a read-only mount requires a remount and therefore I think you can't use fstab to make this persistent and need to script this instead.
Next set up the upload directory:
mkdir -p /var/ftp/Upload
chmod 700 /var/ftp/Upload
chown ftp.ftp /var/ftp/Upload
Then configure vsftpd properly for anonymous downloads and chroot() the anonymous FTP user to /var/ftp. It's been a while since I did that, but roughly and untested:
#The following directives prevent local users from logging in and enables anonymous access respectively.
#The following directive enables write access to the ftp server’s filesystem.
# Sets the root directory for anonymous connections.
Of course there are a lot more relevant options to include.