How to Guides

Use Ubuntu to keep thieves from cracking your USB drive

USB drives, or flash drives, have a spotty reputation. They are extremely useful portable data storage devices, but can also be key to compromising a system and stealing data. This is why it is always good to take steps to make sure your USB drive is secure.


One way to keep your data safe is to encrypt your flash drive and secure it with a password. If you’re on a Linux system, good for you! Aside from being capable of encrypting a user’s Home folder, it is easy to secure USB drive in Ubuntu with Linux. However, there are downsides.

If you use multiple computers, you may have to use an unencrypted flash drive on other operating systems, as a flash drive encrypted on Ubuntu can only work on Ubuntu or other GNOME-based platforms. In addition, there may be some slowdowns in terms of performance, though often they are not noticeable, and it is more difficult to recover data from an encrypted device.

Before you secure your USB drive in Ubuntu with Linux, you have to decide if performance and convenience are less important to you than security. If security is your thing, then by all means, secure your USB in Ubuntu.

Another important step is to back up all the data on your flash drive, because it will need to be formatted.

Download the program

You will need to install a package to secure your USB drive in Ubuntu with Linux—cryptsetup. This can usually be found in the repository. Simply search for “cryptsetup” and install the package using the application manager. Another way to install the package is to use the command line. Open the terminal and type sudo apt-get install -y cryptsetup.

After installation, you will be able to use Ubuntu’s Disk Utility to encrypt the flash drive. It is important to note that cryptsetup needs to be installed in all Linux computers that you use, as it is needed not only to lock your device, but also to open it.

Encrypt the USB disk

Once you have backed up your files and installed cryptsetup, open Ubuntu’s Disk Utility application using the Ubuntu Dash. While Disk Utility is installed by default, if for some reason it is not on your computer, it can be installed using the application manager, or through the command line—enter gnome-disk-utility.

  • Once you have opened Disk Utility.
  • Plug in your USB drive and look for it in “Peripheral Devices”.
  • Unmount the device
  • Then select “Format Volume” to format your flash drive.
  • Tick the box next to “Encrypt” to enable it.
  • Then click on “Format”.

Once you are prompted to enter a passphrase, enter a strong one that will make it difficult for anyone to access your data. You can decide to let Ubuntu remember your passphrase, but it will be safer not to.

After entering your passphrase, your flash drive will be formatted and encrypted.

Accessing data

Once your flash drive is encrypted, you will be prompted for a passphrase every time it is plugged in to an Ubuntu or GNOME computer. Simply enter your password and your flash drive will be good to go. If you are not prompted for a passphrase, or you cannot access your encrypted portable drive, check if Cryptsetup is installed, then try again.

Changing your passphrase

If you decide to change your passphrase, simply use Disk Utility. There is an option there to Change Passphrase. If you wish to format your USB drive or remove encryption, this same program can be used.

  • Simply click on the volume in the view screen.
  • Then click on what you want to do—Format Volume.
  • Delete Partition, Change Passphrase, Edit Partition, or Unlock Volume.

Bottom Line

After you secure your USB in Linux, your data will be as safe as you can make it. However, it would be best to avoid keeping sensitive data on a portable drive, as small devices can easily be stolen.

Note: Read our complete guides, if you are looking to setup VPN on Linux or access Netflix on Linux.

Leave a Comment