Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

Thanks...

share|improve this question
add comment

1 Answer

If, as is likely, when you connect this drive to another Ubuntu machine, it is automatically mounted, you can quite simply remount it as read-only, so its files cannot be altered. In order to learn the /dev/ info and the /media location where it is mounted, simply type mount. Now, with that information, and without even unmounting the drive you wish to be read only, type:

sudo mount -o remount,ro /dev/sdb1 /media/MDrive

Obviously, replace sdb1 and MDrive with the locations and names of your drive. If you ever need it to be writable again, type:

sudo mount -o remount,rw /dev/sdb1 /media/MDrive

There is no way to write protect a hard disk, however, apart from encrypting the entire device.

(If the external disk is not automounted, you will need to do the following: sudo mkdir /media/disk and then sudo mount -t vfat /dev/sdb1 /media/disk -o ro, again replacing vfat with whatever filesystem the disk uses, and /dev with your device node.)

share|improve this answer
    
Oh sir I really appreciate your interest and attention. However, permit me to clarify something important. I am NOT able to do these changes on the linux system where my must read-only ubuntu is mounted. Therefore, I have to do some improvements on my mounted ubuntu. –  Eray Tuncer Jul 20 '12 at 20:38
    
@ErayTuncer These changes are only temporary, in the session, but the still need root access. –  hexafraction Aug 2 '12 at 15:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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