I have a NTFS partition, and I want to share a folder, but I want to manage the access of the subfolders, for example this folder contains 20 subfolders, the desktop users have access to only 10 subfolders. How can I manage this? How can I control a NTFS partition at all?
1 Answers
You can mount the NTFS partition with read-write permissions for root only
sudo mount -o fmask=0177,dmask=0077 /dev/sdaX /media/root-view
where /dev/sdaX is the NTFS partition device, and /media/root-view is a mountpoint, to be created if necessary (obviously, you can choose the name you like).
Then install bindfs allowing to mount a directory on a mountpoint with modified permissions. The bind mount would be established as follow
sudo bindfs -p ugo=rwX /media/root-view/shared /media/user-view
where shared is a directory you want to share, and /media/user-view is another mountpoint, to be created if needed, as above.
Now all users have read-write access to /media/user-view, representing the /shared folder on the NTFS partition, and no access to other directories on the same partition.
You can repeat the bindfs for all directories of your interest, but would be better to reorganize the content of the NTFS partition, putting all directories to share inside a single directory. I mean, change the layout from
/shared01
/shared02
...
/shared10
/unshared01
/unshared02
...
/unshared10
to
/shared
/shared01
/shared02
...
/shared10
/unshared
/unshared01
/unshared02
...
/unshared10
With this layout you only need to share the directory /shared, giving automatic access to all sub-directories.
- 96,093