How to Guides

Use Ubuntu to keep thieves from cracking your USB drive

secure your USB drive in Ubuntu with Linux
Written by Michael Katz

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.

Featured Images By Ubuntu teamwork ( [Public domain], via Wikimedia Commons

About the author

Michael Katz

Michael Katz is a technology and security writer who grew up around technology. From a very early age, he has been in love with computers and follows many of the companies that produce them, hoping to learn more about what makes them tick. When not writing about technology and internet security, he can be found on the pitch with his friends playing a friendly game of football.


  • My brother recommended I would possibly like this web site.
    He was entirely right. This submit actually made my day.
    You can not believe simply how much time I had spent for this info!
    Thank you!

  • Undeniably believe that which you stated. Your favorite
    reason seemed to be on the web the easiest thing to be aware of.
    I say to you, I definitely get annoyed while people consider worries
    that they just don’t know about. You managed to hit
    the nail upon the top as well as defined out the
    whole thing without having side-effects , people could take
    a signal. Will likely be back to get more. Thanks

  • Howdy would you mind letting me know which web host you’re working with?
    I’ve loaded your blog in 3 different internet browsers and I must say this blog loads a lot quicker then most.
    Can you recommend a good internet hosting provider at a reasonable price?

    Thanks, I appreciate it!

  • I’m not sure where you are getting your information, but
    great topic. I needs to spend some time learning more or understanding more.
    Thanks for wonderful info I was looking for this information for my

  • Hi there! I just wanted to ask if you ever have
    any problems with hackers? My last blog (wordpress) was hacked and I ended up losing a few months of hard work due to
    no backup. Do you have any solutions to stop hackers?

  • Excellent blog! Do you have any helpful hints for aspiring writers?
    I’m hoping to start my own site soon but I’m a little lost on everything.
    Would you suggest starting with a free platform like WordPress or go for a paid option? There are so many
    choices out there that I’m totally overwhelmed .. Any suggestions?
    Many thanks!

  • A person essentially help to make severely articles I might state.
    This is the first time I frequented your web page
    and up to now? I amazed with the research you made to create this actual publish extraordinary.
    Excellent process!

  • It’s awesome to visit this website and reading the views of all
    colleagues concerning this article, while I am also eager of getting experience.

  • Hi there! Do you know if they make any plugins to help with SEO?

    I’m trying to get my blog to rank for some targeted keywords but
    I’m not seeing very good success. If you know of any please
    share. Appreciate it!

  • Howdy would you mind letting me know which hosting company you’re utilizing?
    I’ve loaded your blog in 3 different browsers and
    I must say this blog loads a lot quicker then most. Can you
    suggest a good hosting provider at a fair price? Kudos, I appreciate it!

  • We’re a gaggle of volunteers and starting a new scheme in our community.
    Your site provided us with useful information to work on. You have done a
    formidable activity and our entire community can be
    grateful to you.

  • Have you ever thought about adding a little bit more than just your articles? I mean, what you say is important and everything. However think of if you added some great visuals or videos to give your posts more, “pop”! Your content is excellent but with pics and video clips, this blog could undeniably be one of the best in its field. Wonderful blog!

  • Magnificent beat ! I wish to apprentice even as you amend your website, how can i subscribe for a weblog web
    site? The account aided me a acceptable deal.
    I had been a little bit acquainted of this your broadcast provided brilliant transparent idea

  • I’ve been exploring for a little for any high-quality articles or blog posts on this kind of space
    . Exploring in Yahoo I at last stumbled upon this site.
    Reading this info So i’m satisfied to convey that I’ve a very good uncanny feeling
    I found out just what I needed. I so much definitely will make certain to
    do not omit this website and give it a look regularly.

  • Hey there, I think your blog might be having browser compatibility issues.
    When I look at your website in Firefox, it looks fine but when opening in Internet Explorer,
    it has some overlapping. I just wanted to give you a quick heads up!
    Other then that, excellent blog!

  • Please let me know if you’re looking for a writer for your
    weblog. You have some really great articles and I believe
    I would be a good asset. If you ever want to take some of the load off,
    I’d love to write some articles for your blog in exchange for a link
    back to mine. Please shoot me an e-mail if interested. Thank you!

  • Hi there, i read your blog from time to time and i
    own a similar one and i was just wondering if you get a lot of spam feedback?

    If so how do you reduce it, any plugin or anything you can advise?
    I get so much lately it’s driving me mad so any
    help is very much appreciated.

  • I just want to say I’m very new to blogs and seriously enjoyed you’re web site. Almost certainly I’m want to bookmark your site . You surely come with beneficial article content. Kudos for sharing your web page.

Leave a Comment