Write protect your USB/Thumb/Pen Drive

April 3rd, 2008 | Tagged as: ¤ ¤ | Download as PDF

If you are new here. You may want to sign up for e-mail updates or subscribe to my RSS feeds. Thanks for visiting!

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\
    usb_write_protect_1
  • 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).
    usb_write_protect_2
  • Right click in the blank area of the sub key you just created and create a new DWORD value by the name WriteProtect.

usb_write_protect_3

  • Double-click it and set the value data as 1 (and 0 for disabling it).
    usb_write_protect_4
  • 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]

 
{ 46 Comments }
  1. Great tip man. Viruses are so common in hostels and College Labs. Stumbled

  2. Rajavanya says:

    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. Ashfame says:

    @Madhur
    Thanks for the stumble buddy!

    @Rajavanya
    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. Ebook says:

    Wow nice tips again. Waiting for other tips :lol:

  5. Ashfame says:

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

  6. MarcoP says:

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

    http://penprotectorenglish.wordpress.com

    It is great!

    Bye

  7. Tito says:

    Hei chck this out.
    http://editecforum.blogspot.com/2008/06/make-your-usb-read-only-while-putting.html

  8. Ranjith says:

    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.

  9. Ashfame says:

    @Ranjith
    Yes it can be done. Thanks for letting others know. :)

  10. snazzy says:

    nice trick

  11. pardipta says:

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

  12. Abhay says:

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

    thanks buddy

  13. G says:

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

  14. leandro says:

    Download usb protect, the better to protect your pendrive.
    http://www.laesoft.com.ar/descargas/usbprotect.php

  15. G says:

    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)

  16. Janak Dand says:

    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_protect

    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
    http://www.gaijin.at/dlusbwp.php

  17. Juan Pablo from Argentina says:

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

  18. Dr. Uday Wad says:

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

  19. Nitin says:

    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.

  20. will says:

    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.

    • Ashfame says:

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

  21. adhiraj says:

    use quick heal total security it will do it

  22. Nitin says:

    create file for free space with ‘FSUTIL’ command utility

  23. Will says:

    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.

    • Ashfame says:

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

  24. bahram says:

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

    • Ashfame says:

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

  25. ashish says:

    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
    LOL
    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
    Bye
    TC

  26. tameem says:

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

  27. ashish says:

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

  28. ashish says:

    @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!!!

    • Ashfame says:

      Thanks! I just made the switch to Windows 7.

  29. ashish says:

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

    • Ashfame says:

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

  30. OHS says:

    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.

    • ashish says:

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

      • OHS says:

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

        • ashish says:

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

  31. OHS says:

    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.

  32. Kalpesh says:

    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

  33. Kalpesh says:

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

    • Ashfame says:

      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.

  34. Kalpesh says:

    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

    KEEP YOUR COMPUTER CLEAN

    • OHS says:

      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.

      • Ashfame says:

        Thanks for helping Kalpesh!

Leave a Reply

(required)

(required)