LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 11-17-2020, 02:22 PM   #1
blooperx3
Member
 
Registered: Nov 2020
Posts: 67

Rep: Reputation: Disabled
How can I encrypt my micro-sd card using cryptsetup?


I've searched google, but have not found any method whereby I can use cryptsetup to encrypt an sd card.
 
Old 11-17-2020, 02:53 PM   #2
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by blooperx3 View Post
I've searched google, but have not found any method whereby I can use cryptsetup to encrypt an sd card.
Don't be quite so specific. Linux treats it the same as any other device so follow the instructions for encrypting a partition on a disk.
 
Old 11-17-2020, 09:45 PM   #3
blooperx3
Member
 
Registered: Nov 2020
Posts: 67

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by computersavvy View Post
Don't be quite so specific. Linux treats it the same as any other device so follow the instructions for encrypting a partition on a disk.
The only encryption I have done is with cryptsetup - encrypting an entire hdd.
"sudo cryptsetup luksFormat /dev/sdx --iter-time #"

Tried it with the micro-sd - didn't work.

$ sudo cryptsetup luksFormat /dev/sdd1
WARNING: Device /dev/sdd1 already contains a 'ext4' superblock signature.

WARNING!
========
This will overwrite data on /dev/sdd1 irrevocably.

Are you sure? (Type uppercase yes): yes
Operation aborted.

I've tried it a few ways and I keep getting error message: 'operation aborted'.

Last edited by blooperx3; 11-17-2020 at 10:33 PM.
 
Old 11-17-2020, 10:37 PM   #4
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
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.
 
Old 11-17-2020, 10:48 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,130

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
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.
 
Old 11-17-2020, 11:04 PM   #6
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
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.
 
Old 11-17-2020, 11:46 PM   #7
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by blooperx3 View Post
Are you sure? (Type uppercase yes): yes
Operation aborted.

I've tried it a few ways and I keep getting error message: 'operation aborted'.
It says uppercase.

EDIT: Ooops, I had not seen #6.
 
Old 11-18-2020, 01:53 AM   #8
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
FWIW, I just found out that I can run cryptsetup on the device itself, there's no need to create a partition first:
Code:
cryptsetup luksFormat /dev/mmcblk0
(or whatever device) (no partition number)
Kinda cool.
 
Old 11-18-2020, 02:19 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,130

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
It's just a device node - you can also mkfs or pvcreate on one. Has a lot of advantages actually.
 
Old 11-18-2020, 08:32 AM   #10
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
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.
 
Old 11-18-2020, 01:48 PM   #11
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
^ 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.
 
Old 11-18-2020, 04:09 PM   #12
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
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.
 
Old 11-18-2020, 07:44 PM   #13
blooperx3
Member
 
Registered: Nov 2020
Posts: 67

Original Poster
Rep: Reputation: Disabled
yes, it needed uppercase

appreciate the help)

Last edited by blooperx3; 11-18-2020 at 08:03 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Encrypt root partition using cryptsetup asteroid4u Linux - Server 4 07-27-2017 03:27 PM
[SOLVED] Strange behaviour 2Gb SD then 16Gb micro SD in usb All in 1 micro card reader hdp160 Linux - Hardware 4 08-03-2015 06:06 AM
encrypt and decrypt using encrypt(char block[64], int edflag) rockwell_001 Linux - Security 3 08-30-2009 09:16 AM
People who call it M$ or Micro$oft or Micro$loth lowpro2k3 General 48 12-24-2007 12:19 AM
LXer: Imation 4GB Micro Hard Drive: Still Micro on the Outside, More Giga on the Inside LXer Syndicated Linux News 0 12-28-2005 06:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration