Write protection is the ability of a hardware device or software program to prevent new information from being written or old information being changed. Typically, this means you can read the data, but not write. In the picture is an example of a write-protection switch on an SD card that turns on and off write protect on that card.
Enable and disable write protection using software
To protect a file in the Microsoft Windows command line or in MS-DOS use the attrib command. With Windows, you can view the file properties and enable the read-only attribute. Finally, with a Linux variant or Unix the chmod command could be used to enable and disable write protection.
Tip: With the Microsoft Windows attrib command and file properties suggestion this allows you (and anyone else) to add and remove write protection (read-only). If you want to prevent others from changing the write protection setup network users and permissions.
Enable and disable write protection with hardware
In addition to SD cards, earlier removable media such as a floppy diskette use write protection. The 5.25-inch floppy diskette had a hole in the upper corner of the diskette that could be covered with tape to enable write protection. The 3.5-inch diskette had a tab in the corner that could be moved up or down to enable or disable write protection. By moving the tab to block the hole or unblock the hole, you could enable and disable write protection.
Why use write protection?
As mentioned above, by using write protection you can help ensure data is not accidentally overwritten or erased. For example, if you had an SD card with lots of pictures you did not want removed you could enable write protection. Of course, if you were to do this no new pictures could be added.
With floppy diskettes companies would often have the diskettes write-protected to prevent the diskettes from being mistakenly overwritten and erasing the program on the diskette. With 3.25" floppy diskettes, the tab would often be missing from the diskette. However, covering the hole with a piece of tape would allow you to write to the diskette.