How to make symbolic link on Linux chroot or jail user

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.



2 thoughts on “How to make symbolic link on Linux chroot or jail user

  1. I’d like to thank you for the efforts you’ve put in penning this website.
    I’m hoping to see the same high-grade blog posts by you later
    on as well. In truth, your creative writing abilities has
    encouraged me to get my very own website now ?

Leave a Reply

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