How can I encrypt my micro-sd card using cryptsetup?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What didn't work? Did you actually use that exact syntax? There is no /dev/sdx. SD cards are often seen as /dev/mmcblk0 instead of /dev/sdc or whatever. What error message did you get? What does lsblk show for drives? As computersavvy said, one drive is like another for cryptsetup, as long as you give it the correct device name. And you need to encrypt a partition, not a full drive. There are many tutorials on using cryptsetup available on the internet. Perhaps reading one or more of them would give you more of an idea on how to go about it.
Don't you just hate it when people edit an answer while you're typing a response ?. At least it's now longer then one (short) sentence.
As suggested, let's see "lsblk -f" with the card plugged in.
Did you not notice that you were instructed to type uppercase YES? If you type yes, of course it aborts. It will abort if you type anything at all other than YES.
I'm far from expert on cryptsetup, and I've never tried to encrypt an entire drive. I generally need at least some unencrypted space, and I don't need a lot of encrypted space. I usually use Veracrypt for my encryption, and put both Linux and Windows portable versions on the drive, with an encrypted file container, so it can be used anywhere to access the encryted data. That makes more sense to me, but perhaps not everyone. For encrypting files on my HDD, though, it's somewhat cumbersome and a partition encrypted with cryptsetup is easier to use. So encrypting an entire drive isn't something I really care about. But my use case is not anyone else's, so it's good to know that an entire drive can be encrypted if desired. It still seems easier to just encrypt the partition, but perhaps not.
^ I just think it's a neat use case for having a completely encrypted removable medium to pop in/out.
And it saves a few extra commands when formatting.
File managers recognize the format and present you with a password dialog.
Yes, that's what I get from the encrypted partition on my SD card, which stays in the computer's slot. The file manager (Thunar in my case) displays it and presents a password dialog when I click on it. That's much more convenient than Veracrypt, but not as portable. Horses for courses, and all that. In the meantime, blooperx3 has not returned.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.