At home I am having NTFS partition on which Windows is installed. Some time I used to mount my NTFS partition on Ubuntu box for some work. Due to some reason I want to restrict the access of other Ubuntu users to this partition.
To solve this problem we can use fstab file. Suppose if a particular partition contains a VFAT or NTFS filesystem, and you only wish to be able to access it yourself, it’s pretty simple:
include the options “noauto”, “uid=XXX”, and “umask=7” in fstab line, and remove the “user” and/or “users” options if they appear there now.
This means that at boot time the system will come up with that partition unmounted, and only you (operating as root, using sudo presumably) can mount it
once mounted, it will be owned by your unprivileged user (assuming that that user’s uid is XXX, which is given to the first user created at install time in MDV installs – check with the “id” command run as that user, and adjust fstab accordingly) and will be inaccessible to all other local users.
Now we will try to do this process in 4 easy steps.
Step 1 Open fstab file as,
gksudo gedit /etc/fstab
Step 2 You should add line in /etc/fstab file as follows,
/dev/sdb5 /media/techinote ntfs-3g noauto,uid=XXX,unmask=7 0 0
Here XXX is my user id. You can find yours with id command and /dev/sdb5 is partition I want to restrict access to.
Step 3 Create a folder named techienote in /media/ as follows,
sudo mkdir /media/techienote
Step 4 Now whenever you login you need to mount it as,
sudo mount /dev/sdb5 /media/techienote