2

So I made a mistake yesterday, accidentally deleting essential Windows files when working in Ubuntu (namely NTUSER.DAT).

Just quickly my system set-up: I have Windows 7 (NTFS partition) and Ubuntu (Ext4 partition) dual boot, with all my documents, pictures, etc in Windows. Normal usage for me is working in Ubuntu with files on the Windows partition. (reason for this set-up: Ubuntu can read NTFS while Windows cannot read Ext4, and I need Windows for e.g. Photoshop)

Now, I want to protect myself from making another stupid mistake in future. I want to protect specific essential Windows files, located on the NTFS partition, from editing when working in Ubuntu (installed on Ext4 partition).

I read the following on StackExchange security:

The file and folder/directory permissions on an operating system are managed and enforced by... you guessed it right, that operating system (OS). When the operating system is taken out of the picture (booting a different operating system), then those permissions become meaningless.

One way to think of it: You hire a big bodyguard (OS) to protect your house. You give him a list (permissions) of the allowed guests (users) and which areas (files and folders) they're allowed to visit. How useful are those lists when the bodyguard is asleep (not booting from that OS)?

Given the above, is it possible to protect myself? If so, how? Note that I'm just talking about protection in my own, current Ubuntu installation, not from new installations or live CDs.

4

You can "remove" from yourself the temptation of modifying Windows files by hiding them via .hidden files.

Just place a file with name .hidden in the directory where the files you want to protect are located and put a file or directory name in each line. These files will be hidden from file managers (except dolphin I think) and the terminal (unless you put the -a flag).

For example to hide the Windows and Program Files directories:

cd <win_partition>
gedit .hidden

Write Windows in the first line and Program Files in the second line. Feel free to complete the list with all the files you want to "protect".

Edit: Keep in mind that this does not "protect" the files from being matched by bash auto completion. For example, rm -rf * in the Windows partition is still catastrophic.

1

I would suggest a slightly different approach. Create a separate partition in Windows (e.g. drive D:) and store all of your data files (e.g. documents, pictures, etc.) in that partition. Mount the data partition in Ubuntu but do not mount the main Windows partition. Now, all your data files will be accessible to both operating systems, but Ubuntu won't be able to see any of the Windows files relating to the OS and the apps. This strategy also makes backup of the data files very easy.

  • Defenitely smart solution for fresh installations, a bit too much hassle in my case. In any case, something to remember! lifehacker.com/5271338/… – Koen Apr 17 '15 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.