Encrypt pendrive with LUKS (2024)

Have you ever wanted to own an encrypted pendrive which will be unreadable and uncrackable (with strong enough password) to third parties without your password?

Your files on laptop may be encrypted and safe but what about the files on pendrives you use? Removing a file from unencrypted pendrive does not make it impossible to retrieve it. Encrypt a pendrive and you can be always safe.

Password for encrypted pendrive can easily be changed without modifying or erasing the pendrive contents.

In this episode we will encrypt pendrive with LUKS and format it with ext4or ntfs filesystem. Your pendrive data will be removed in the process so back it up.

Switch to root.

su -

Put the pendrive in and list all disks in order to find your pendrive.

lsblk
Encrypt pendrive with LUKS (2)

Locate your pendrive. My pendrive called 64GB is device/dev/sdb with one partition /dev/sdb1 mounted under /run/media/andrzej.rehmann/64GB .

Move all your data to a save place as we will remove all pendrive content.

Unmount pendrive and check the result.

umount /dev/<pendrive_partition>
lsblk
Encrypt pendrive with LUKS (3)

We will now encrypt the pendrive. This will remove all pendrive contents.

cryptsetup luksFormat /dev/<pendrive_device>
Encrypt pendrive with LUKS (4)

That’s it. Pendrive is now encrypted but is not usable yet.

We will now create filesystem on our pendrive.

First let’s decrypt/open it.

cryptsetup luksOpen /dev/<pendrive_device> <luks_name>
lsblk

Where <luks_name> is some random string of your choosing (this is not a persistent name, don’t worry).

Encrypt pendrive with LUKS (5)

You can overwrite pendrive with shredto wipe it’s previous content but it can take a while. I’m not going to do this.

shred -n 1 mapper/<luks_name>

Create file system. I’m using ext4, but you can choose other filesystem like NTFSor FAT.

For ext4 which will work on Linux no problem but will require additional software on Windows use:

mkfs -t ext4 -L "<label>" /dev/mapper/<luks_name> # Ext4

Ext4 is a journalling filesystem which means that if the device is unplugged prematurely it stands more of a chance of recovering the damaged filesystem. It can support volumes up to 1 ExbiByte (a lot).

For NTFS which should work on Windows no problem but may require additional software on some Linux distributions use:

mkfs -t ntfs -L "<label>" /dev/mapper/<luks_name> # NTFS

Where <label> is your new pendrive name.

Encrypt pendrive with LUKS (6)

After mkfs is finished pull out the pendrive and plug it back in. You should see a modal window asking for you pendrive password.

Encrypt pendrive with LUKS (7)

If you don’t see this window open file browser and click on the pendrive as if you wanted to browse its content. You should be asked for a password then.

Encrypt pendrive with LUKS (8)

It’s done. You can check that indeed your pendrive is now encrypted.

lsblk
Encrypt pendrive with LUKS (9)

If you see the luks-UUID as the partition name it means that that partition is encrypted. My /dev/sdc (it switched from /dev/sdb ) pendrive is now encrypted.

The last step is necessary only if you used ext4 file system. Your pendrive is owned by root user at the moment so you won’t be able to write to it, we need to fix this.

chown -R <user>:<user> <pendrive_mount_point>
Encrypt pendrive with LUKS (10)

No my pendrive is owned by my user and ready to use.

Encrypt pendrive with LUKS (11)

If you are interested with installing a Fedora 26 with ZFS and encryption then check out my series here: https://medium.com/@AndrzejRehmann/preparing-fedora-laptop-with-zfs-and-encryption-part-1-f5788dda79ab

Encrypt pendrive with LUKS (2024)
Top Articles
What is the Gig Economy and Its Benefits?
How to Buy Gold Bars & Silver Coins at APMEX
Google Doodle Baseball Classroom
Springfield Pridenet
I Love You in Spanish (and Its Variations)
S&P 500 Hits Record High Buoyed by Economic Hopes: Markets Wrap
Senior Finance Manager - Commercial International » London, Greater London
Nascar Starting Lineup For Sunday Race
Stigmata Of Sacrilege F95
Elemental Showtimes Near Sedaliamovies
How To Play BucketBall
LIVE UPDATES: South Shore Week 3 high school football scores and highlights
Mahjong Undress Party
Who Is Mikaylah? Age, Boyfriend, Net Worth, Wiki & More
Waitlistcheck Sign Up
Acbl Homeport
Paisanos Duncan Sc Menu
Current Students
Why Did the Soviet Union Collapse?
Tulsa police probe Craigslist posting bragging of "first kill"
12 30Pm Cdt
6Ar6Ie Leaked
Amouranth Ph
Forza Horizon 5: 8 Best Cars For Rally Racing
Yarzon Scavenger
Bald Eagle Screech
Jobs Hiring 18 Year Olds Near Me
Where Is The Expiration Date On Hatfield Ham Steak
Fox 17 Football Blitz
Brett Cooper Wikifeet
Ur Cluster Search Engine
norfolk gigs - craigslist
Palm Coast Permits Online
Kfc Menu Open Now
Beacon Schneider Gibson County
Fab Pedigree
Kinepolis Nîmes Multiplexe - IMAX
Rex Parker 10/8/22
Renfield Showtimes Near Paragon Theaters - Coral Square
Craigslist.org Knoxville
Atrium Orthopedic Urgent Care
Chris Medlin: Credits, Bio, News & More | Broadway World
Miami vs Fort Lauderdale: Which is better?
Young & Restless Dirty Laundry
Oil Change Services | Jiffy Lube
Topeka Pets Craigslist
Cherry Crush Webtoon Summary
Megan Mullally | Rotten Tomatoes
Nuefliks.com
Zolo Rentals
Chc Walk In Edmonds
Skagitregionalhealth.or/Mychart
Latest Posts
Article information

Author: Gov. Deandrea McKenzie

Last Updated:

Views: 5827

Rating: 4.6 / 5 (66 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Gov. Deandrea McKenzie

Birthday: 2001-01-17

Address: Suite 769 2454 Marsha Coves, Debbieton, MS 95002

Phone: +813077629322

Job: Real-Estate Executive

Hobby: Archery, Metal detecting, Kitesurfing, Genealogy, Kitesurfing, Calligraphy, Roller skating

Introduction: My name is Gov. Deandrea McKenzie, I am a spotless, clean, glamorous, sparkling, adventurous, nice, brainy person who loves writing and wants to share my knowledge and understanding with you.