0

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...

1 Answer 1

1

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.)

2
  • 1
    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. Jul 20, 2012 at 20:38
  • @ErayTuncer These changes are only temporary, in the session, but the still need root access.
    – nanofarad
    Aug 2, 2012 at 15:33

You must log in to answer this question.

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