Technology in terms you understand. Sign up for my weekly newsletter, "Confident Computing", for more solutions you can use to make your life easier. Click here.

Can a flash drive that has a Linux install on it become infected?

//
Leo, I’ve got a USB flash drive with a full persistent bootable installation of Linux on it. Can this flash drive become infected if I plug into a Windows machine with a virus on it? Say at an internet café or a public library?

The answer is yes, no, and maybe. It’s complex, but it’s a good question to ask because the devil is in the details.

Let me explain how this works.

Become a Patron of Ask Leo! and go ad-free!

How malware gets around

Some malware can use removable drives like USB flash drives to transfer from machine to machine.

Malware on an infected Windows machine can detect when a new drive is attached to your computer. It’ll actually copy itself to that drive. At that point, the flash drive is technically infected, but it’s really only the carrier of the disease, not actually an infected host.

When you then insert that drive into another Windows machine and Auto Play or Auto Run happens to be active, the malware on that flash drive can run automatically and infect that machine.

Tux - The Linux Mascot
Tux – The Linux Mascot

Linux and Windows viruses

In your case, the Linux installation is not likely to be infected. Malware usually targets Windows. Even though the flash drive has a Linux installation, it’s still just a collection of files. That they happen to be files that make up a Linux installation is irrelevant.

Another thing to consider is that Linux and Windows can use different file systems. Windows has FAT or NTFS; Linux has additional ones that can be used. That flash drive is only readable by Windows if it’s a FAT or NTFS file system. If the drive has any other file system, you won’t be able to copy Windows files (or Windows malware) to it. Conversely, files aren’t going to be readable from that Linux-formatted drive once you take them to another Windows machine.

Because you are using that flash drive to take data to and from internet cafes or public libraries, I assume it’s configured for Windows with either a FAT or NTFS filesystem. Even if you have partitioned the flash drive so one part is Linux and another part is Windows, that Windows partition could still be a vector for malware.

Do you see why my answer was complex? In short, to answer your question:

  • Yes, your flash drive can be used as a carrier for malware.
  • No. Your Linux installation is quite safe.
  • Maybe. Because a few things like compatible file systems and Auto Run on those Windows systems have to all be in place for this to happen.

Caution’s warranted, but my guess is that you’re probably okay.

2 comments on “Can a flash drive that has a Linux install on it become infected?”

  1. My take on the question was that the asker has a “bootable installation of Linux” on a flash drive because when he gets to the library or internet cafe, he inserts the thumb drive, then reboots the computer into Linux! He is using his portable Linux on the public computers at those places. Not a bad idea, IMO, of course it probably breaks the rules at the cafe or library, but, oh well.

    In that scenario, I _believe_ he is safe from any Windows viruses on the PC, as long as he doesn’t go browsing the hard drive and snatching files. I wouldn’t mind hearing the experts’ take on that, of course!

    Reply
    • Yes, if he’s booting into Linux and doing “normal” things that should also reduce dramatically (nearly eliminate) the chances of the flash drive becoming infected or an infection carrier.

      Reply

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.