Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wonder whether there is a way to make my ubuntu read-only when I mount it on another linux system. Let me clear what I want. I have a usb stick on where my ubuntu is installed. However, the problem is that I am able to change the files or folder on it by mounting it another ubuntu. How can I preserve it?


Edit: Guys thank you to all for your attention. However, I should add this information that I am not able to make any changes on the linux system onto where I plugged my ubuntu usb stick. This is why I have to do something on my ubuntu.

share|improve this question

If you want to mount it read-only by hand you can add the read-only option when mounting -o ro the drive (or add the option to the fstab if you do it more often). check man mount for more information.

If you want to preserve files being changed when mounted on any other system you cannot. At least not unless there is hardware write protection on the drive. There were switches on disks to do this, there are switches on SD Cards to do the same, not sure if there are USB-Sticks available with those switches.

share|improve this answer
The problem with the switches on SDcards is that it is not a hardware write protect. More a 'please do not write to me' request. – Hennes Jul 18 '12 at 22:18
Should be the same on cassettes and disks, but probably still the best way to prevent accidental writing. – Baarn Jul 18 '12 at 22:24
I agree, though I stress the word 'accidental'. – Hennes Jul 18 '12 at 22:27

You can get a pen drive with a hardware write-protect switch on it, or you can ask the person mounting the pen drive to mount it read only (see man mount, the rw and ro options).

If you are afraid that someone else will mount the pen drive and change things then encrypt the drive. Either the whole drive via hardware (which mean buy a pen drive which supports this) or via software (encrypt the filesystem).

share|improve this answer
encrypting does not prevent corruption of the files, only hinders the other person to read. depending on what you try to achieve this can have a negative impact (person thinks the drive is empty and reformats it) – Baarn Jul 18 '12 at 22:27
True. Though the OP specifies 'on another linux system' and it is not a question of just pressing on the 'windows can not read ... Format it?' button. – Hennes Jul 18 '12 at 22:31
Sure, but it still depends on the environment you are using, most file managers should recognize an encrypted filesystem, but the partition should look pretty much dead if you simply tried to mount it via console. – Baarn Jul 18 '12 at 22:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .