Opening encrypted volumes using a script [closed]
I have two encrypted volumes that I use occasionally. One is a partition and the other is a container file. I always use them at the same time.
I currently open them using something like this:
$ sudo cryptsetup -y open --type plain /dev/sda4 v1
$ sudo mount -t ext4 /dev/mapper/v1 /mnt/v1
$ sudo losetup /dev/loop0 v2
$ sudo cryptsetup open --type luks /dev/loop0 v2
$ sudo mount -t ext4 /dev/mapper/v2 /mnt/v2
But it's laborious entering these commands every time, even if I use history expansion.
If I put the commands in a script, is it possible to get the script to ask me to enter the passphrase for each volume?
shell-script cryptsetup
closed as off-topic by terdon♦ Dec 16 at 16:17
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – terdon
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
I have two encrypted volumes that I use occasionally. One is a partition and the other is a container file. I always use them at the same time.
I currently open them using something like this:
$ sudo cryptsetup -y open --type plain /dev/sda4 v1
$ sudo mount -t ext4 /dev/mapper/v1 /mnt/v1
$ sudo losetup /dev/loop0 v2
$ sudo cryptsetup open --type luks /dev/loop0 v2
$ sudo mount -t ext4 /dev/mapper/v2 /mnt/v2
But it's laborious entering these commands every time, even if I use history expansion.
If I put the commands in a script, is it possible to get the script to ask me to enter the passphrase for each volume?
shell-script cryptsetup
closed as off-topic by terdon♦ Dec 16 at 16:17
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – terdon
If this question can be reworded to fit the rules in the help center, please edit the question.
Have you tried? Because that's exactly what it'll do...
– Fabby
Dec 16 at 11:40
add a comment |
I have two encrypted volumes that I use occasionally. One is a partition and the other is a container file. I always use them at the same time.
I currently open them using something like this:
$ sudo cryptsetup -y open --type plain /dev/sda4 v1
$ sudo mount -t ext4 /dev/mapper/v1 /mnt/v1
$ sudo losetup /dev/loop0 v2
$ sudo cryptsetup open --type luks /dev/loop0 v2
$ sudo mount -t ext4 /dev/mapper/v2 /mnt/v2
But it's laborious entering these commands every time, even if I use history expansion.
If I put the commands in a script, is it possible to get the script to ask me to enter the passphrase for each volume?
shell-script cryptsetup
I have two encrypted volumes that I use occasionally. One is a partition and the other is a container file. I always use them at the same time.
I currently open them using something like this:
$ sudo cryptsetup -y open --type plain /dev/sda4 v1
$ sudo mount -t ext4 /dev/mapper/v1 /mnt/v1
$ sudo losetup /dev/loop0 v2
$ sudo cryptsetup open --type luks /dev/loop0 v2
$ sudo mount -t ext4 /dev/mapper/v2 /mnt/v2
But it's laborious entering these commands every time, even if I use history expansion.
If I put the commands in a script, is it possible to get the script to ask me to enter the passphrase for each volume?
shell-script cryptsetup
shell-script cryptsetup
edited Dec 16 at 10:28
Vlastimil
7,6911260133
7,6911260133
asked Dec 16 at 10:26
EmmaV
1,1091331
1,1091331
closed as off-topic by terdon♦ Dec 16 at 16:17
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – terdon
If this question can be reworded to fit the rules in the help center, please edit the question.
closed as off-topic by terdon♦ Dec 16 at 16:17
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – terdon
If this question can be reworded to fit the rules in the help center, please edit the question.
Have you tried? Because that's exactly what it'll do...
– Fabby
Dec 16 at 11:40
add a comment |
Have you tried? Because that's exactly what it'll do...
– Fabby
Dec 16 at 11:40
Have you tried? Because that's exactly what it'll do...
– Fabby
Dec 16 at 11:40
Have you tried? Because that's exactly what it'll do...
– Fabby
Dec 16 at 11:40
add a comment |
2 Answers
2
active
oldest
votes
Silly me. I should have tested before asking.
I am asked for the passphrases when executing these commands in a script.
add a comment |
read -sp ‘Enter passphrase ‘ pw
echo “${pw}” | cryptsetup ...
should do the trick
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Silly me. I should have tested before asking.
I am asked for the passphrases when executing these commands in a script.
add a comment |
Silly me. I should have tested before asking.
I am asked for the passphrases when executing these commands in a script.
add a comment |
Silly me. I should have tested before asking.
I am asked for the passphrases when executing these commands in a script.
Silly me. I should have tested before asking.
I am asked for the passphrases when executing these commands in a script.
answered Dec 16 at 14:51
EmmaV
1,1091331
1,1091331
add a comment |
add a comment |
read -sp ‘Enter passphrase ‘ pw
echo “${pw}” | cryptsetup ...
should do the trick
add a comment |
read -sp ‘Enter passphrase ‘ pw
echo “${pw}” | cryptsetup ...
should do the trick
add a comment |
read -sp ‘Enter passphrase ‘ pw
echo “${pw}” | cryptsetup ...
should do the trick
read -sp ‘Enter passphrase ‘ pw
echo “${pw}” | cryptsetup ...
should do the trick
edited Dec 16 at 15:59
vfbsilva
2,62711227
2,62711227
answered Dec 16 at 15:01
jas-
71238
71238
add a comment |
add a comment |
Have you tried? Because that's exactly what it'll do...
– Fabby
Dec 16 at 11:40