1. Home
  2. Linux

How to secure a USB flash drive on Linux

Flash drives are excellent for keeping data private. They’re small, easy to carry and can even fit on a keychain. Still, without any real security features on these little devices, anyone can access your files.¬†On Windows and Mac, it’s quite easy to secure a USB flash drive with a couple of clicks. Linux, on the other hand, isn’t as simple. As a result, many Linux users tend to avoid securing their USB flash drives, and this is troubling.

Securing a USB flash drive on the Linux platform can be done in a couple of ways, with more than a few encryption tools. In this post, we’ll cover a few ways you can easily encrypt and secure your data on Linux. Let’s get started!

Install Gnome Disks and encryption tools

There are a few ways to encrypt entire disks on the Linux platform. With that said, the Gnome Disks application makes locking an external USB flash drive easier than ever.

If you use a Gnome-based Linux desktop environment, there’s a good chance you’ve got the Gnome Disks app installed. However, not everyone has it set up out of the box, so in this section of the guide, we’ll quickly go over how you can set up the application on Linux. Also, we’ll also show you how to get Cryptsetup, the encryption tool that is used within Gnome Disks to encrypt file-systems.

To install Gnome Disks on Linux, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T and follow the instructions that correspond with the OS you use.

Ubuntu

Ubuntu users will be able to get the latest release of the Gnome Disk Utility application and the Cryptsetup package by using the Apt command in the terminal window below.

sudo apt install gnome-disk-utility cryptsetup

Debian

Are you on Debian Linux? Need to get your hands on Gnome Disk Utility and Cryptsetup? Lucky for you, the app is in the central software repository! To install it, go to the terminal and enter the following Apt-get command.

Note: Debian Linux is a reliable Linux distribution, but it’s applications often lag behind other OSes because it releases updates at a much slower pace. If your release of Gnome Disks is missing features, consider installing Debian Backports. It’ll allow you to get newer software.

sudo apt-get install gnome-disk-utility cryptsetup

Arch Linux

Arch Linux users should have no issue getting the absolute latest release of the Gnome Disks application, or Cryptsetup for that matter thanks to the fact that it’s a bleeding edge Linux distribution.

The Gnome Disks application is in the “Extra” software repository, and the Cryptsetup tool is in “Core”. Ensure both are enabled in your /etc/pacman.conf file. Once they are, you’ll be able to install it with the Pacman command below.

sudo pacman -S gnome-disk-utility cryptsetup

Fedora

Fedora Linux’s default release is very Gnome-centric, so there’s a good chance you’ve already got the latest Gnome Disks application on your Linux PC. If you don’t, you’ll be able to set it up with the following DNF command.

sudo dnf install gnome-disk-utility cryptsetup

OpenSUSE

OpenSUSE Linux has a Gnome release that many people use, so a good chunk of users may already have the Gnome Disks app on their computer. However, if you’re not using the Gnome version, you may want to install Gnome Disks on your system with the following Zypper command.

sudo zypper install gnome-disk-utility cryptsetup

Encrypt USB drive – Gnome Disks

Launch the Gnome Disks application on your Linux computer. After that, plug in the USB Flash drive you plan to encrypt. Once it’s plugged into the system, locate it in the side-bar on the left and click on it.

When you’ve loaded up your USB Flash drive in Gnome Disks, you’ll need to format it to a Linux file-system. To format, click on the menu button. Then, in the menu, select the option that says “Format Disk.”

Clicking “Format Disk” will bring up a menu. In this menu, there are two options. These options are “Erase” and “Partitioning”. Set the first option to “Quick,” and the second option to “MBR / DOS”.

Allow the drive to format and erase all of the data. When the formatting is done, click the “+” button, set the “Type” option to “Encrypted, compatible with Linux systems”.

Using the filesystem menu, set up your USB Flash drive with a passcode. Then, when everything looks good, click the “Create” button to finish the encryption process.

Access Encrypted USB Drive

Now that your USB Flash drive is encrypted with LUKS, it’s completely secure. If you’d like to put files on it, you’ll need to mount it to the system first. To mount the drive, plug it into the USB port and launch your file manager.

In the file manager, look for your flash drive in the list of devices on the left. Double-click on the drive and enter your password to access the encrypted USB drive.

Once you have access to the encrypted USB drive, it works like any other device on Linux. To put files on it, simply drag them into the folder.

Leave a comment