How to Encrypt USB Drive on Ubuntu 18.04 LTS

Encryption is the best way to protect your important documents personal info and other credentials. Suppose, you have a USB pen drive and your all important data stored on it. In case you will lose your USB pen drive, all data stored on it will be lost. It will be in hands of some other person which will access your personal information and misuse it. So, the best solution to protect your data is to encrypt your USB pen drive with password.

In this tutorial, we will learn how to encrypt your USB drive on Ubuntu 18.04 LTS.


  • Ubuntu 18.04 desktop installed on your system.
  • A non-root user with sudo privileges.

Install Required Tools

First, you will need to install gnome-disk-utility and cryptsetup to your system. Cryptsetup is a utility for setting up encrypted filesystems with the help of Device Mapper and dm-crypt. You can install both tools with the following command:

sudo apt-get install gnome-disk-utility cryptsetup -y

Encrypt USB Drive

IMPORTANT: Before you proceed, back up all data that is on the USB Media as the data on the USB Media gets erased when the partition type is changed to an encrypted partition.

First, plug in your USB flash drive to the system. Next, launch the Disks utility from the Unity Dash. You should see USB drive in the left pane:

Search for disks

Ubuntu Disk Manager

Next, umount the filesystem as shown below:

Unmount the Filesystem

Next, click on the Format button as shown below:

Select Format

Next, select encryption type, partition name and set your password as shown below:

Set Partition type and password

Now, click on the Format button to encrypt the USB drive.

Access USB Drive

Your USB pen drive is now secure with a password. To test it, unplug and plug in USB drive again. You should be asked to input password to get access the partition as shown below:

Enter Password to access USB device

Now, provide the password and click on the Connect button. You can access your USB pen drive.

Encrypted USB drive has been mounted.

Share this page:

Suggested articles

3 Comment(s)

Add comment


By: Jean-Francois Messier

My only concern is that such encryption is only useable under Linux. a Windows user, or someone with multiple OSes will have problems getting access to those encrypted files, if not using Linux. Do you have some solution to such problem ? 

By: Marius

Hello fellows, 

a) your mobile photo sucks. 8 years a Linux user and you never heared of time-delayed-screenshots?

Let me help you out:

gnome-screenshot -p -w -d 5

-d 5  => 5 SECONDS... adjustable timeframe ;)b) @JFM

1) there is a windows version of a luks-mounter, but it is not a wise idee to use old betaware. from the principle side, luks is OSS and you can use and build it on Windows too. be creative ;)

2) working solution : VeraCrypt

You can use VeraCrypt to make a disk-encryption that it compatible with linux, windows and mac, if you format the resulting partition with NTFS.

BUT, of course, if you carry your VeraCrypt-Drive to a stock windows without VeraCrypt installed, you can't decode it.

Admin hint: Make a small not-encrypted partition on the usb-drive to store your encryption software. That way, if a computer does not have VC installed, you can install it when needed ;) Don't forget to update it from time to time.

By: daryl

Thanks this helped a lot