Sometimes we need to create a jailed user on Linux to restrict that user.
However, sometimes we need the jailed user to be able to access directories outside the home directory of the jailed user.
How to allow access to a symbolic link when chrooted on the home directory.
In this situation, symbolic links and hard links will failed.
Then we will use the mount command with the addition of bind.
For example the jail user’s directory is /hom /jail/home/user and you want that user to be able to access /var/www/html/video_upload
[root@serverdiary ~]# mkdir -p /home/jail/home/user/video_upload [root@serverdiary ~]# mount --bind /var/www/html/video_upload /home/jail/home/user/video_upload
And to enable on boot, edit /etc/fstab and add this line at the end
/var/www/html/video_upload /home/jail/home/user/video_upload none rw,bind 0 0
To test your fstab first unmount /home/jail/home/user/video_upload and then try to mount all volume.
[root@serverdiary ~]# umount /home/jail/home/user/video_upload [root@serverdiary ~]# mount -a
Hope this helps.