Saturday, May 12, 2018

How to Easily make ‘NTFS’ Partitions read-only in Ubuntu



How to Easily make ‘NTFS’ Partitions read-only in Ubuntu 12.10?

The NTFS file system is a lot more complex than the FAT (16/32) file systems. Plus, Microsoft does not reveal all of its technical details (documents), thus, the GNU/Linux developers took their time while enabling the ‘write’ support for NTFS.
These days, almost all GNU/Linux distributions (including Ubuntu) use a lower level software tool called ‘ntfs-3g‘ (a Kernel module), as it is the most reliable one from the bunch (there are others too). I have been using it from the beginning (including the days where we had to install it manually) and over the years it has matured a lot too.
However, I still don’t feel comfortable using it, with read-write enabled, because once accessed my Windows 7 partitions with it, even in recent versions of Ubuntu (such as the 12.04) where it contains up-to-date ntfs-3g drivers, has been a bit troublesome for me.
For example, it has happened more than once that, when I save images into a NTFS partition in Ubuntu, I cannot open them later in Windows 7. And interestingly, under the file size it says ‘zero’, but if I boot back into Ubuntu, then I can view them without any issues whatsoever.
And one or two times (recently), when running the disk check tool, Windows 7 had to fix the file system and I lost some data in the process as well. So usually, as soon as I install Ubuntu, I manually set the NTFS access to read-only as a safety precaution.
There are many way that you can do this in Ubuntu, if you do not like to use the command-line and edit the ‘fstab’ file (a configuration file that holds various information about how to mount file systems in GNU/Linux), then you can use the ‘ntfs-config’ utility.
However, if you are using Ubuntu 12.10 Quantal Quetzal, then you can use a built in tool called ‘Disks’ for easily changing NTFS access permissions, without having to install a software utility manually.
If interested, then please follow the below procedure for that.
Step 1:
First, click on the ‘Dash’ icon and search for the following term.
disks
Then as shown below, click on its icon to open the program.

Step 2:
Once opened, on its main window, ‘Disks’ graphically shows you your current partition layout.
Gnome-Shells-new-Disks-tool
Now simply choose the NTFS partition that you want to change the permission of, then click on the small gears icon slightly below it, then from the menu choose: ‘Edit Mount Options…’

Step 3:
1. From the next window that you get, move the button to the left, under the option ‘Automatic Mount Options’, to get access to the settings.
2. Now, remove the check-mark under the option ‘Mount at startup’.
You can let it stay enabled too, but I prefer to let Nautilus (file manager) mount the NTFS partitions, after the desktop is loaded, to speed up the boot-up process.
3. Then, as shown in the below screenshot, you will see a field that says ‘nosuid,nodev,nofail,x-gvfs-show’.
Now all you have to do is, simply copy and paste the below code, and add (paste) it to the end of that text line (without a space).
,ro

Step 4:
Once done, click on the ‘OK’ button at the bottom, when asked enter your administrative password, and now you are done!.
If you have more than one NTFS partition, then follow the same steps for setting up the permission to each one individually.
Now try opening a NTFS partition in Nautilus (or any utility) and you will notice that you no longer can ‘Cut’ or ‘Delete’ files inside it, as it is mounted with read-only permissions.
How to disable it?
If later, you wanted to re-enable the read-write support, then simply remove that manually added ‘,ro’ code (or, you can also move that top button to the right side, until you see the option ‘ON), and save your changes. That’s it!.
Note: Please remember this works in Ubuntu 12.10 and later versions only.

Thanks to: https://www.hecticgeek.com/2012/10/make-ntfs-partitions-read-only-in-ubuntu/