Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
07-24-2006, 08:19 PM
|
#1
|
Member
Registered: Jul 2005
Distribution: Fedora6 x86_64
Posts: 118
Rep:
|
dm-crypt, USB and umount/mount
Folks,
I've been using dm-crypt in such a way with USB keys and it works fine:
[insert USB key]
cryptosetup create /dev/mapper/sda1 /dev/sda1
mount /dev/mapper/sda1 /mnt/usb
When I'm done copying files to the USB key, I do, to take the USB key out:
umount /mnt/usb
This effectively unmounts the device (eg. df does not show it anymore).
Problem is, if I re-insert the USB key and try to mount it again, it does not work. cryptosetup reports that the device already exists.
Fair enough. I do: cryptosetup remove sda1
But then I try to re-create and it issues an error:
cryptosetup create /dev/mapper/sda1 /dev/sda1
"Command failed: Block device required"
If the computer is rebooted, then I can start from top and it works again.
What is the proper procedure to unmount an encrypted USB key so it can be mounted again later without rebooting the computer (this isn't Windows after all !! ;-)
Thanks.
|
|
|
07-24-2006, 08:58 PM
|
#2
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep:
|
I believe you need to do cryptosetup remove, then umount. Always do things symmetrically, like matching parentheses. mount -> cryptosetup -> cryptosetup remove -> umount.
|
|
|
07-24-2006, 09:51 PM
|
#3
|
Member
Registered: Jul 2005
Distribution: Fedora6 x86_64
Posts: 118
Original Poster
Rep:
|
That's it. So simple after all. I tried it and it works. Here it is:
Start:
[insert USB key]
cryptosetup create /dev/mapper/sda1 /dev/sda1
mount /dev/mapper/sda1 /mnt/usb
[do stuff with USB key]
umount /mnt/usb
cryptosetup remove sda1
[disconnect USB key]
goto Start
|
|
|
07-24-2006, 11:35 PM
|
#4
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep:
|
Oops, yeah, I had mine backwards, thinking of a loopback mounted file. But you definitely have it there.
|
|
|
All times are GMT -5. The time now is 03:16 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|