Write protect your USB/Thumb/Pen Drive

It happens with me many time that I had to copy some files from my pen drive to our college lab and the moment I plugged in my pen drive, it gets infected with dozens of viruses. Yes, its true that our college labs are too infected. Now before I can use the pen drive again, I need to make sure to clean it first so that the virus may not spread on more computers. I scan for my pen drive using NOD32 and no doubt it completely remove all traces of virus but it wastes my time as I always have over 2 GB of files that I carry with me all the time.

So I came to know of this trick of write protecting the drive so that I can safely copy things I want without the worry of virus being copied on my USB drive. Although you won’t be able to write any thing on your pen drive, its still very useful in case you want something to copy from your pen drive and don’t want to get infected. Before proceeding I must tell you that playing with the registry can be harmful for your Operating System (OS) and I advise you to take a backup of your registry in case anything goes wrong. Read how to Backup Windows Registry.

This trick works only on XP SP2 and you need to have administrator privileges.

  • Open Registry Editor by Start > Run.
  • Type in regedit.
  • Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\
  • Locate the sub-key StorageDevicePolicies. If it doesn’t exist then create it first. Create a new key under Control by right clicking on it so that you don’t create it elsewhere by mistake (as shown in the above screenshot).
  • Right click in the blank area of the sub key you just created and create a new DWORD value by the name WriteProtect.


  • Double-click it and set the value data as 1 (and 0 for disabling it).
  • Click OK, close the Registry Editor and restart the PC.

The drawback of this trick is that you need to remember this trick by yourself and you need to restart the PC after applying this trick. Killing explorer.exe and restarting it will not do the job everytime. I am still looking for any other ways fo protecting your drives and I will post in on my blog if I found a better trick than this one. Share your thoughts in the comment.

[via Techtree.com]


79 responses to “Write protect your USB/Thumb/Pen Drive”

  1. Great tip man. Viruses are so common in hostels and College Labs. Stumbled

  2. http://www.techtola.com/2008/01/ways-to-prevent-70-virus-malware.html

    Check out software restriction policy in that post…
    You can prevent many viruses

    PLease PLease give me ur comments to improve that article

  3. @Madhur
    Thanks for the stumble buddy!

    Post is short. It can be expanded much to an extent that it can serve a purpose. You are providing good information over there but there is a difference between a half glass of water and a glass full of water. Quench the thirst and then that guide will hold some authority.

  4. Wow nice tips again. Waiting for other tips πŸ˜†

  5. @Ebook
    You are welcome. Subscribe to my feeds so that you don’t miss any of them.

  6. MarcoP Avatar

    You can write protect a pen drive from viruses by this software:


    It is great!


  7. Viruses can also be killed by booting any Linux OS from a live CD. Then inserting the pen drive and then deleting files directly from it.Since exe files will not run in linux , it will not affect your system.

  8. @Ranjith
    Yes it can be done. Thanks for letting others know. πŸ™‚

  9. nice trick

  10. friend ,its really working…..
    thank u verymuch…..

  11. superb i tried many software but option was already in ma system

    thanks buddy

  12. After write protecting my pendrive. How to disable it. I will frequently copy and delete items from my pendrive.

  13. Download usb protect, the better to protect your pendrive.

  14. what if the there is no access to registry? (most of the time there won’t be unless you have administrative rights or its your pc)

  15. Janak Dand Avatar
    Janak Dand

    There may be cases where we may want to connect our USB flash / pen drive to computers only for reading the data from it. If the host computer in which you plug your USB drive may be infected and may infect your USB flash drive. If the USB drive is only being connected for data reading purposes then it makes sense to make them write protected (read only) so that the Viruses won’t be able to infect the drive.

    Certain USB flash / pen drives come with write protector switch in them, using which you can write protect the USB flash / pen drive or make them read only drives. If the write protect feature is missing in the USB flash / pen drive then you can use USB Write Protector utility.


    USB Write Protector is a free utility that allows you make write protect your USB flash / pen drives. This is a very small utility that you can always carry with you in your portable drive.

    Note: This utility does not make your USB drive write protected rather it makes the host computer on which this utility is run unable to write to removable storage media like USB flash drives.

    Download USB Write Protector

    1. MD KANYAN Avatar

      koi Write protected remove k liye b software hai kya ?
      reply me

  16. Juan Pablo from Argentina Avatar
    Juan Pablo from Argentina

    good tip man!, I hope that virus programmers do not read this article!

  17. Dr. Uday Wad Avatar
    Dr. Uday Wad

    Thanx for this tip, Otherwise USB Pen drive is a big big problem.

  18. Hey Dude, Nice tip but a difficult one to follow everytime. Lot to remember. http://www.techyard.net/3-ways-protect-usb-pendrives-from-virus/ Check this one. Download the first first tip software which works on your lines only i suppose.

  19. If I understand it correct, then it write protects on the PC you modify registry. It is not practical to modify registry on each foreign PC I have to plug my pen drive into.

    1. @will
      Yes, some pen drives come with a physical write protect switch to protect from infection.

  20. use quick heal total security it will do it

  21. create file for free space with ‘FSUTIL’ command utility

  22. Very smart Nitin. Maybe I can write a small program that fills every byte with a dummy file making zero byte available to write or alter anything onto it.

    1. @Will
      That’s not a good alternative if you ask me because it will use up more of your flash drive and they have limited read/writes although a high count and it will take much of the time everytime you want to write protect it.

  23. when put usb flash ram to usb port then in my computer open removable driver.not open driver and not format.please help me

    1. @bahram
      You probably have a faulty drive. Get it changed if its in the warranty.

  24. Nice tip bro…..

    Bt still wht i found this new trick
    check this out
    When you insert your pendrive go in properties
    then go on hardware tab and select your pendrive
    i.e. for eg. If i m using kingston Pendrive i will select Kingston in option
    and double click it
    and select the option Enable this device and change it to disable option
    It will stop pendrive to work
    but the trick is that your pendrive is already been detected by PC so it will show you that window bt viruses wont work on your pendrive cause you have disabled it
    This trick works for me….
    Hope it will Help….
    Or i am having second trick as well
    just let me know on my email address

  25. if you wanna usb write protect soft use bitlocker…….

  26. @tameem
    Buddy If u r talking abt some external software then I am not quiet sure. Did you try it?

  27. @Ashfame
    Hi ashish,
    I am using windows 7. In that they have given the built in option to lock up ur removeable drives. So for all
    If u r using windows 7 here are the simple steps to secure ur pendrive from viruses….
    Go to Start….>then control panel…..>go to system and security tab….>BitLocker Drive Encryption
    now finally select the removable drive and select “TURN ON BITLOCKER”
    You are done!!!

    1. Thanks! I just made the switch to Windows 7.

  28. @ashfame
    hey no probs….
    and one more thing
    do u have some other Blog or fourm….???

    1. I do have another blog coming up and a forum starting from next month.

  29. Seems like you need to have admin access to every
    PC you’re planning on using the USB stick on, to be able to change the
    registry. And once you’ve done that, pray to god that the malware you’re
    trying to protect it from, is written by a morons.

    Malware, once installed, owns the machine in almost all cases. Every
    registry change you do, it can reset behind your back. And malware
    generally doesn’t give a shit about Storage Device Policies. They bypass
    it or disable it.

    So, while this may sound like a good idea on the surface, it gives you
    zero protection.

    1. @OHS
      Well may be IDK abt the malware thing bt pretty sure abt how u can get the administrator privaleges…
      here are the steps…
      if u r accesing the computer from diffrent user Press ctrl+alt+Del and then type in the name box administrator if it has a password then it will give you error now here is the trick try and log in by “Guest” or .net account genrally these accounts are password free..so access in and do the things you wanted to do…..

      1. Sorry, I have a hard time comprehending what you are saying. Could you rephrase in normal english?

        1. @OHS
          hey man I am sorry..
          Ok I will try again…
          To get the Administrator Rights on any pc do this
          Log-in by using the .NET account
          generally this account don’t have a password and all the rights of the system..
          so go in CP (Control Panel)….> User accounts…>and now create the new USER with all the access which will work same as administrator….
          Final step…
          Right Click on My computer Icon And go to manage….>Users…>Right click on Administrator and Disable it Restart your PC and access it from the user you have created…
          That’s it….Now change the Registry Value as shown above…
          Please feel free to ask me back if you have any queries….

          NOTE: These steps are only for windows XP.

  30. Logging in as admin is only a problem on PCs you don’t control yourself. And those are the machines most likely to have malware on them. And it does nothing to help against malware just creating a new user with admin rights. Malware is only a problem once it’s installed, and then all bets are off. It’s essentially ‘God’ on your machine. It doesn’t care what the admin is called. Like I said, you can’t hinder malware writing to your USB stick when it owns the machine. Also, have you tried logging in with the ASP.NET account, trying to fiddle with the admin account? Can’t be done, unless there’s something very wrong with your setup. And another thing, if you want to disable the admin account and create a new account with admin rights, you can do that when logged in as the Administrator. No need to jump through hoops.

    But my main point is that the registry trick won’t work on malware dead set on writing to your USB stick.

    Btw, IT security is my job.

  31. Hi, How to do the opposite of this, “Prevent Data from Pen Drive / usb being copied to computer, this would prevent virus, worm from writing itself to computer, but we should be able to copy data from computer to usb

    1. It is not possible the way you wanted. You can try disabling USB autorun – http://blog.ashfame.com/2008/03/disable-usb-autorun-save-pc-usb-viruses/
      The virus can’t spread until its executed. After all its just a code which needs to execute to do anything.

  32. Hi, There are some Virus/ Worms it spreads itself without executing as soon as connect it to computer

    1. Hi Kalpesh!

      That’s because they are executed either by USB autorun feature or when it is double clicked on the folder icon to open the usb drive.

      A virus is harmless until it is executed. Think about it. If doesn’t get executed how will the computer know what bad things to do. Virus just contain the instructions to evil stuff.

      And they trap the user by making them execute them somehow. I hope you got the point.

  33. Hi, Today searching the WEB i found one software Called “Net Studio USB Firewall” it say it stop autorun virus, i am not aware whether it can block heuristic virus, I have tested many Top Rated Antivirus like Norton, Eset, Avast, AVG, and few others but no one even comes close to “Kaspersky”

    Try “KASPERSKY INTERNET SECURITY 2010” and see the difference, along with it you can also install “Advanced System Protector” spyware remover(Systweak Product)- Free Scan & Clean


    1. Kalpesh, there is no need for any antivirus to stop autorun viruses. Just turn off autorun and there’s no longer any threat from it happening.

      1. Thanks for helping Kalpesh!

  34. thanks i will try it if it will run then advance.. thanks……………

    1. You are welcome!

  35. indra Avatar

    use linux no………..:)

    1. I do πŸ˜‰
      It was written when I used to run Windows.

  36. But I am not able to remove it from my 4GB-Transcend-pendrive with the above method?? Any other solution?? I am using windows 7.

    1. kalpesh Avatar

      The solution provided above are for windows xp, use kaspersky internet security

      1. Use of antivirus is always recommended.

    2. Remove? Didn’t get it

  37. Gaurav Avatar

    I think the best way to Protect Pendrive is to download the below software
    this software can Write-Protect Pendrive. Also it can create one undeletable and unwritable autorun.inf so that virus can not amend it. It also monitors Pendrive from automatically executing files and it blocks them and shows the list to user.User can them unblock them(if it is safe). You can even change the background picture of pen-drive.
    Its extremely useful FREE software with no malware.

    1. Sorry, no links that I don’t trust.

  38. Hey Fruitful tip but i have another option also for USB Encryption

  39. rupali Avatar

    plz send me write protect software for my iball pendrive

    1. yeah sure πŸ˜›

  40. Hi Rupali, its not possible to provide software links here, else this blog shall be black listed, This is my temporary orkut id add me so i can do the needful


    1. lolz! First learn what’s your correct link of profile.

      1. lolz! its correct link of profile.

  41. Hi Sir,

    It’s carter from Infomicro China. Glad to hear that you’re on the market for
    USB and Memory.
    We are a manufacture of USB of leading quality and we have specialized in these fields for decades.
    We supply products for Lexar with Life-time warranty and competitive price.
    If you have any questions, please do not hesitate to contact me.

  42. […] Registry Editor by Start > […]

  43. I’ve created small utility for protecting usb drives. It creates or modifies dummy file which takes all free space and there is no more space for viruses – http://code.google.com/p/usbdummyprotect/

  44. markzenegar Avatar

    Nice blog article, can you provide me some other sites which can provide information like. Currently I was just referring these two site. One is techarena.in and the other one that I was using is techtree.

  45. anup gharat Avatar
    anup gharat

    Hi friends, i have a sloution for ur issue.
    You can make ur normal pen drive to virus protected pendrive & it dosen’t require any software. For that u want 1 pc which having windows vista 0r 7 os installed.

    Follow the below steps……..

    1) Connect ur pen drive to pc which having widows vista or windows 7 operating system. (The user must having Administrator rights)
    2) Open ‘My Computer’ & right click on pendrive icon then select ‘Format’ option. Before formatting you must take a back up of all of your data because it deletes whole data from ur pen drive.
    3) In Format window select file system tab & change it to ‘NTFS’ then click on ‘Start’ to start formatting.
    4) After formatting done close the format window & open ur pendrive.
    5) create one folder in pen drive & rename it to ‘secured’.
    6)some viruses are caused to hide the data. so, we need to protect our ‘secured’ folder. so, create one shortcut for secured folder. for that right click on ‘secured’ folder select ‘send to desktop (create shortcut)’ shortcut will be created on desktop. move it to pen drive. (This shortcut will useful if ur secured folder will made hidden by viruses in future)
    7) Back to ‘My Computer’ & again right click on pendrive & now select ‘Properties’ tab.
    8) In properties window select security tab then click on edit & tick on ‘Deny’ for ‘Write’ permission then press ok to apply the settings.
    9) Open pen drive again, right click on ‘Secured’ folder select ‘Properties’ then ‘Security’ tab. again click on ‘Edit’ button & set ‘Allow’ permission to ‘Full Control’ then click ok to apply settings.
    10) Open ‘Secured’ folder, create one folder into that & rename it to ‘Secured.exe’.
    11) Right click on ‘Secured.exe’ folder select ‘Properties’ & make it hidden by selecting ‘Hidden’ attribute & apply it then select ‘security’ tab click on ‘Edit’ & set ‘Deny’ permission to ‘Full Control’.(after that virus can’t create exe file on secured folder)
    10) Press ‘Ok’ to apply the settings.
    Now ur pen drive is virus protected & it works in all windows nt based operating systems, but u can’t copy files into that directly. u need to copy all of ur files to the secured folder. I recommand that copy ur software setup files to the zip folder so, virus can’t access software’s exe files & if possible do not create more folders so, virus can’t create new viruses (exe files) into ur folders. U can use zip files for copying folders also.

    Anup Gharat

  46. Pagar S.K. Avatar
    Pagar S.K.

    Dear Sir,
    I am Software Developer. I want a Device or some Solution about file and folder copy protection. Which means I Require Device such that before coping my protected folder from it. it should ask password ,but every one can access that folder

  47. Pagar S.K. Avatar
    Pagar S.K.

    Dear Sir,
    I want a Device or some Solution about file and folder copy protection. Which means I Require Device such a that before coping my protected folder from it. it should ask password ,but every one can access that folder


    1. Its not that easily possible. Allowing to access is called a read which means they can copy too. You will have to do a lot of work here to figure out how you can wrap it up the way you want. Even then it won’t be flawless, it will be breakable for sure.

  48. venkatesh kumar Avatar
    venkatesh kumar

    thank u somuch

  49. Nick Rawniko Avatar
    Nick Rawniko

    This tip is not good enough,, any more tips ?

  50. thanks Ashish,

    your trick really works well
    my usb flash has been recovered from suffering the “write protected” ill.

    have good learning and sharing for you

  51. thank you. great

  52. Mohit Kumar Avatar
    Mohit Kumar

    it didnt work for me, i couldn’t disable the write protect even after going through the above steps…plz help

  53. Parimal Ajudiya Avatar
    Parimal Ajudiya

    buy a pen drive with hardware based write protection, only last solution in this planet……….good bye

  54. Hello;
    Is there a way to PASSWORD-PROTECT my thumb-drive?


  55. rupinder Avatar

    plz tell how to remove write protection from kingston pendrive except regedit method bcoz that is not work properly.plz give another solution.help me