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