This blog has permanently moved to

Contact Form | Email Address

© 2018 All rights reserved by Boseji

Thank you for all your support.

Saturday, September 18, 2010

Save the Pen Drive from Infection (a.k.a USB Storage Protection)

Recently I found a trick to make my Pen Drives safe. This was to say that if you connect to an Infected PC you may be spared by warnings only. In fact as per study the majority of people who work on Windows XP operating systems are affected by this problems. I found an permanent solution to this, however this would block only the "Autorun" method of infection by the Virus. For Others you still need to be care full, as they might infect your other files.
Certain category of the Virus and Worms spread by hiding inside the "Recycle Bin" folder and installing executable code in the special file - "Autorun.inf". This file is responsible for both setting the Icons for the Pen Drive and also contains "Attach-time-Execution-instructions" for the drive. The Virus thus modifies this file to make sure that next time the pen drive is plugged into another PC the Virus can spread. My method here is simply to avoid this. In fact this has already been explained many times on the web, however I am publishing a compiled version of steps help get all in one place.

1. First we need to convert the Pen Drive file system to NTFS.
     All Widows versions after 2000 support this file system so
     there is not reason to worry.
     To proceed First Back Up all Data from the Pen Drive.
     To do this take the Uninfected Pen Drive!! in an Uninfected PC!!
     (This would work only before the Infection has happened)
     Plug it into the PC with Administrator Privileges
     (Logged in as Administrator) or the User has Admin rights.
    Open the Terminal Window by executing the "cmd" command
     from the Start Menu => Run.
     Now go to the Pen Drive " drive letter" by typing ":"
     in the Terminal.
     Suppose if my Pen Drive is connected as "H:" then I
     type "H:" and press enter

     In general the Pen Drives are formated by default as FAT32,
     but to make them safe we need to make them NTFS.
     Give the Command "convert : /FS:NTFS",
     It would warn you, give yes.
     Suppose the Drive is connected to H: then
      convert H: FS:/NTFS

      After this by keeping the Pen Drive attached, Reboot the System.
      When the Windows reboots it would configure the Pen Drive to NTFS.

2. Create the "Autorun.inf" file.
      This can be done by simply saving a Text file in Notepad in
       the Pen Drive as "Autorun.inf" .

3. Protecting the "Autorun.inf" file.
      Open a Terminal window in the way as stated earlier.
      Give the following commands in a Sequence:
       attrib -a Autorun.inf /S /D
       attrib +s +h +r Autorun.inf /S /D
       cacls Autorun.inf /c /d everyone
       Now it would ask for confirmation answer with 'y'

4. Creating Recycle Bin Folder.
      This can be performed in the same Terminal Window as above.
      Give the command: "md Recycler"

5. Protecting the Recycle Bin Folder.
      This can be performed in the same Terminal Window as above.
      Give the following commands in a Sequence:
      attrib +s +h +r Recycler /S /D
      cacls Recycler /c /d everyone
      This would ask for confirmation answer with 'y'

Now when the virus or the infected computer tries to access
this drive then there would be warning.

Hope that this helps to prevent further problems although not be full proof
but "prevention is better than cure".

The original article was taken from: Source 1 and Source 2

Warm Regards,


  1. Thanks Bosji
    yeh i m looking for this stuf long time
    thaks again

  2. You are welcome.

    Warm Regards,