Mount Linux folders from one location to another

All on one server….
First why do it : because user2 has access only to one of user1’s folders.
Neat 😉
How to do it :
# mount -o bind /home/user1/folder1 /home/user2/folder2/
Note : /home/user2/folder2/ must exist as target location
In this way, user2 sees only folder1 of user1 (and its subfolders), and the rest of the user1 folders re invisible to him.

How to make this mount permanent (to automatically set up after reboot)? Well if it is about a few mount p[oints, no problem, use /etc/fstab, but what if it is about more than 100 mount points? Well, then you write a little script for mounting them, and activate the script on startup, because you call it through file : /etc/rc.local (just add a line with absolute path to script, and full name of it).

This entry was posted in Linux and tagged . Bookmark the permalink.

Comments are closed.