How to protect USB key

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
Level 1
Level 1
Posts: 9
Joined: Mon Apr 29, 2019 11:01 am

How to protect USB key

Post by kasydo »

I want to put my USB key in readonly without erase files.
I saw on internet with windows we do it with Diskpart attributes set readonly ......etc.
I look for same thing in linux mint. I must to be able to set and remove readonly everytime I need it.

I want that nobody can modify or format usb key instead me even in Windows or other OS.

Thanks to the community.
User avatar
Level 18
Level 18
Posts: 8433
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: How to protect USB key

Post by all41 »

Will others have read-only access?
If not you could just encrypt.
I don't know what it would take to prevent formatting.
There are some keys with pin# buttons and some have fingerprint access.
Everything is difficult before it gets easy.
Level 8
Level 8
Posts: 2461
Joined: Tue Feb 16, 2016 3:12 am

Re: How to protect USB key

Post by Petermint »

There are USB sticks with write protection switches which should work on all machines and operating systems.
Some SD cards have read only switches. You could use one of them in an adaptor.
An Ext4 partition can be flagged as read only in recent versions of Linux. What is the format of the partition on the USB stick?
A storage device can be set as read only in your system but it does not handle read only in other machines. Do you want that?
Encryption by itself does not stop writes once the encryption is open.

If you have a fast USB stick and the master data on another disk, you can just recopy the files when there is a write.
An example: ... 8P1Q&psc=1
Last edited by Petermint on Sat Oct 08, 2022 2:10 am, edited 1 time in total.
Level 4
Level 4
Posts: 342
Joined: Wed Aug 14, 2019 1:02 am

Re: How to protect USB key

Post by billyswong »

I never heard any mainstream USB key can prevent other people from formatting it in their own computer. Hash check and detect modifications to files within (then overwrite if found) is the closest thing I can think of.

If it's just for preventing accidental modification, we can always change file / folder permission to read only (+ execute). The DiskPart attribute in Windows you mentioned are just some more obscure way to achieve the same purpose. The other guy can always delete the whole partition at any time.
Post Reply

Return to “Beginner Questions”