Is it possible to encrypt all files in a folder including their file names but totally without compression...
I have a folder with several files:
file1
file2
file3
I want to encrypt them all with AES including the file names so the output should be something like this:
kjk437fjk437
3k4jn34jk
j34nkj34
But I do not want to apply any compression at all.
Is it possible to do this with 7zip? I am using Debian and looking for Terminal based solutions only.
Edit: I also want to be able to get the filename back after decryption.
linux encryption 7-zip
add a comment |
I have a folder with several files:
file1
file2
file3
I want to encrypt them all with AES including the file names so the output should be something like this:
kjk437fjk437
3k4jn34jk
j34nkj34
But I do not want to apply any compression at all.
Is it possible to do this with 7zip? I am using Debian and looking for Terminal based solutions only.
Edit: I also want to be able to get the filename back after decryption.
linux encryption 7-zip
Please clarify your requirements: why do you need to avoid compression?
– grawity
Jan 21 at 8:17
Did you think of encrypting the filenames in an extra step as simple string encryption?
– Julian F. Weinert
Jan 21 at 16:43
add a comment |
I have a folder with several files:
file1
file2
file3
I want to encrypt them all with AES including the file names so the output should be something like this:
kjk437fjk437
3k4jn34jk
j34nkj34
But I do not want to apply any compression at all.
Is it possible to do this with 7zip? I am using Debian and looking for Terminal based solutions only.
Edit: I also want to be able to get the filename back after decryption.
linux encryption 7-zip
I have a folder with several files:
file1
file2
file3
I want to encrypt them all with AES including the file names so the output should be something like this:
kjk437fjk437
3k4jn34jk
j34nkj34
But I do not want to apply any compression at all.
Is it possible to do this with 7zip? I am using Debian and looking for Terminal based solutions only.
Edit: I also want to be able to get the filename back after decryption.
linux encryption 7-zip
linux encryption 7-zip
edited Jan 21 at 10:04
Vesa
asked Jan 21 at 5:54
VesaVesa
170211
170211
Please clarify your requirements: why do you need to avoid compression?
– grawity
Jan 21 at 8:17
Did you think of encrypting the filenames in an extra step as simple string encryption?
– Julian F. Weinert
Jan 21 at 16:43
add a comment |
Please clarify your requirements: why do you need to avoid compression?
– grawity
Jan 21 at 8:17
Did you think of encrypting the filenames in an extra step as simple string encryption?
– Julian F. Weinert
Jan 21 at 16:43
Please clarify your requirements: why do you need to avoid compression?
– grawity
Jan 21 at 8:17
Please clarify your requirements: why do you need to avoid compression?
– grawity
Jan 21 at 8:17
Did you think of encrypting the filenames in an extra step as simple string encryption?
– Julian F. Weinert
Jan 21 at 16:43
Did you think of encrypting the filenames in an extra step as simple string encryption?
– Julian F. Weinert
Jan 21 at 16:43
add a comment |
2 Answers
2
active
oldest
votes
You probably just want to hide the filename instead of to encrypt it, so something like the following should do:
for file in ./*;do
7z a $RANDOM-$RANDOM.7z -m1=copy -mhe -psecret "$file";
rm "$file"
done
-m1=copy
means use copy method, so no compression.-mhe
means encrypt header, so without password one cannot view filenames inside the 7z file.-psecret
sets password to secret
Interesting. But how can I get the filename back when I want to decrypt again?
– Vesa
Jan 21 at 10:03
@Vesa the original filename is stored in the archive. You get the original file + filename back just by extracting it.
– David Dai
Jan 21 at 21:05
And this also AES encrypts the content of the file?
– Vesa
Jan 21 at 21:31
@Vesa I believe it does.
– David Dai
Jan 21 at 21:48
I will test it soon
– Vesa
Jan 22 at 0:10
|
show 2 more comments
Is 7zip a must? Choose the right tool. EncFS seems to be it.
- Install it. In Debian:
apt-get install encfs
. Create two directories:
mkdir encrypted mountpoint
.
Run the tool:
encfs "$PWD/encrypted" "$PWD/mountpoint"
Note you need
$PWD/
instead of./
becauseencfs
doesn't accept relative paths (unless-f
is used).
Proceed as instructed to choose encryption, password.
Copy or move all directories and files you want to encrypt to
./mountpoint
. Encrypted directories and files will appear in the./encrypted
directory.
Unmount:
fusermount -u ./mountpoint
You can now copy/move/rename/tar/whatever the ./encrypted
directory as a whole. Note there is a hidden .xml
file inside. The file includes the (password protected) key which is crucial, so don't lose it. It's possible to store the file separetely (read about ENCFS6_CONFIG
variable in man 1 encfs
).
To access the original files, repeat step 3, provide the right password. Work with files under the chosen mountpoint: read, add, remove, modify, anything goes. Finally unmount with fusermount -u
like in step 6.
Notes:
encfs
is FUSE (filesystem in userspace). See Why FUSE might be considered insecure on server?
- There are also EncFS-specific security concerns.
Cannot use encfs on this device, otherwise I would as I used to before.
– Vesa
Jan 21 at 10:02
@Vesa It's somewhat disappointing you knew aboutencfs
and you knew you can't use it now, still you didn't explicitly ruled it out. I did notice you're asking about a 7zip solution; but sticking to some tool is often a Y in XY problem, while good answers should concentrate on X and this is what I was trying to do. The answer will stay (with other users in mind), unless you change the question so it clearly saysencfs
is not an option. Regardless, I do hope you'll get an answer that fits you. Good luck.
– Kamil Maciorowski
Jan 21 at 10:45
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1396477%2fis-it-possible-to-encrypt-all-files-in-a-folder-including-their-file-names-but-t%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You probably just want to hide the filename instead of to encrypt it, so something like the following should do:
for file in ./*;do
7z a $RANDOM-$RANDOM.7z -m1=copy -mhe -psecret "$file";
rm "$file"
done
-m1=copy
means use copy method, so no compression.-mhe
means encrypt header, so without password one cannot view filenames inside the 7z file.-psecret
sets password to secret
Interesting. But how can I get the filename back when I want to decrypt again?
– Vesa
Jan 21 at 10:03
@Vesa the original filename is stored in the archive. You get the original file + filename back just by extracting it.
– David Dai
Jan 21 at 21:05
And this also AES encrypts the content of the file?
– Vesa
Jan 21 at 21:31
@Vesa I believe it does.
– David Dai
Jan 21 at 21:48
I will test it soon
– Vesa
Jan 22 at 0:10
|
show 2 more comments
You probably just want to hide the filename instead of to encrypt it, so something like the following should do:
for file in ./*;do
7z a $RANDOM-$RANDOM.7z -m1=copy -mhe -psecret "$file";
rm "$file"
done
-m1=copy
means use copy method, so no compression.-mhe
means encrypt header, so without password one cannot view filenames inside the 7z file.-psecret
sets password to secret
Interesting. But how can I get the filename back when I want to decrypt again?
– Vesa
Jan 21 at 10:03
@Vesa the original filename is stored in the archive. You get the original file + filename back just by extracting it.
– David Dai
Jan 21 at 21:05
And this also AES encrypts the content of the file?
– Vesa
Jan 21 at 21:31
@Vesa I believe it does.
– David Dai
Jan 21 at 21:48
I will test it soon
– Vesa
Jan 22 at 0:10
|
show 2 more comments
You probably just want to hide the filename instead of to encrypt it, so something like the following should do:
for file in ./*;do
7z a $RANDOM-$RANDOM.7z -m1=copy -mhe -psecret "$file";
rm "$file"
done
-m1=copy
means use copy method, so no compression.-mhe
means encrypt header, so without password one cannot view filenames inside the 7z file.-psecret
sets password to secret
You probably just want to hide the filename instead of to encrypt it, so something like the following should do:
for file in ./*;do
7z a $RANDOM-$RANDOM.7z -m1=copy -mhe -psecret "$file";
rm "$file"
done
-m1=copy
means use copy method, so no compression.-mhe
means encrypt header, so without password one cannot view filenames inside the 7z file.-psecret
sets password to secret
answered Jan 21 at 7:55
David DaiDavid Dai
1,734819
1,734819
Interesting. But how can I get the filename back when I want to decrypt again?
– Vesa
Jan 21 at 10:03
@Vesa the original filename is stored in the archive. You get the original file + filename back just by extracting it.
– David Dai
Jan 21 at 21:05
And this also AES encrypts the content of the file?
– Vesa
Jan 21 at 21:31
@Vesa I believe it does.
– David Dai
Jan 21 at 21:48
I will test it soon
– Vesa
Jan 22 at 0:10
|
show 2 more comments
Interesting. But how can I get the filename back when I want to decrypt again?
– Vesa
Jan 21 at 10:03
@Vesa the original filename is stored in the archive. You get the original file + filename back just by extracting it.
– David Dai
Jan 21 at 21:05
And this also AES encrypts the content of the file?
– Vesa
Jan 21 at 21:31
@Vesa I believe it does.
– David Dai
Jan 21 at 21:48
I will test it soon
– Vesa
Jan 22 at 0:10
Interesting. But how can I get the filename back when I want to decrypt again?
– Vesa
Jan 21 at 10:03
Interesting. But how can I get the filename back when I want to decrypt again?
– Vesa
Jan 21 at 10:03
@Vesa the original filename is stored in the archive. You get the original file + filename back just by extracting it.
– David Dai
Jan 21 at 21:05
@Vesa the original filename is stored in the archive. You get the original file + filename back just by extracting it.
– David Dai
Jan 21 at 21:05
And this also AES encrypts the content of the file?
– Vesa
Jan 21 at 21:31
And this also AES encrypts the content of the file?
– Vesa
Jan 21 at 21:31
@Vesa I believe it does.
– David Dai
Jan 21 at 21:48
@Vesa I believe it does.
– David Dai
Jan 21 at 21:48
I will test it soon
– Vesa
Jan 22 at 0:10
I will test it soon
– Vesa
Jan 22 at 0:10
|
show 2 more comments
Is 7zip a must? Choose the right tool. EncFS seems to be it.
- Install it. In Debian:
apt-get install encfs
. Create two directories:
mkdir encrypted mountpoint
.
Run the tool:
encfs "$PWD/encrypted" "$PWD/mountpoint"
Note you need
$PWD/
instead of./
becauseencfs
doesn't accept relative paths (unless-f
is used).
Proceed as instructed to choose encryption, password.
Copy or move all directories and files you want to encrypt to
./mountpoint
. Encrypted directories and files will appear in the./encrypted
directory.
Unmount:
fusermount -u ./mountpoint
You can now copy/move/rename/tar/whatever the ./encrypted
directory as a whole. Note there is a hidden .xml
file inside. The file includes the (password protected) key which is crucial, so don't lose it. It's possible to store the file separetely (read about ENCFS6_CONFIG
variable in man 1 encfs
).
To access the original files, repeat step 3, provide the right password. Work with files under the chosen mountpoint: read, add, remove, modify, anything goes. Finally unmount with fusermount -u
like in step 6.
Notes:
encfs
is FUSE (filesystem in userspace). See Why FUSE might be considered insecure on server?
- There are also EncFS-specific security concerns.
Cannot use encfs on this device, otherwise I would as I used to before.
– Vesa
Jan 21 at 10:02
@Vesa It's somewhat disappointing you knew aboutencfs
and you knew you can't use it now, still you didn't explicitly ruled it out. I did notice you're asking about a 7zip solution; but sticking to some tool is often a Y in XY problem, while good answers should concentrate on X and this is what I was trying to do. The answer will stay (with other users in mind), unless you change the question so it clearly saysencfs
is not an option. Regardless, I do hope you'll get an answer that fits you. Good luck.
– Kamil Maciorowski
Jan 21 at 10:45
add a comment |
Is 7zip a must? Choose the right tool. EncFS seems to be it.
- Install it. In Debian:
apt-get install encfs
. Create two directories:
mkdir encrypted mountpoint
.
Run the tool:
encfs "$PWD/encrypted" "$PWD/mountpoint"
Note you need
$PWD/
instead of./
becauseencfs
doesn't accept relative paths (unless-f
is used).
Proceed as instructed to choose encryption, password.
Copy or move all directories and files you want to encrypt to
./mountpoint
. Encrypted directories and files will appear in the./encrypted
directory.
Unmount:
fusermount -u ./mountpoint
You can now copy/move/rename/tar/whatever the ./encrypted
directory as a whole. Note there is a hidden .xml
file inside. The file includes the (password protected) key which is crucial, so don't lose it. It's possible to store the file separetely (read about ENCFS6_CONFIG
variable in man 1 encfs
).
To access the original files, repeat step 3, provide the right password. Work with files under the chosen mountpoint: read, add, remove, modify, anything goes. Finally unmount with fusermount -u
like in step 6.
Notes:
encfs
is FUSE (filesystem in userspace). See Why FUSE might be considered insecure on server?
- There are also EncFS-specific security concerns.
Cannot use encfs on this device, otherwise I would as I used to before.
– Vesa
Jan 21 at 10:02
@Vesa It's somewhat disappointing you knew aboutencfs
and you knew you can't use it now, still you didn't explicitly ruled it out. I did notice you're asking about a 7zip solution; but sticking to some tool is often a Y in XY problem, while good answers should concentrate on X and this is what I was trying to do. The answer will stay (with other users in mind), unless you change the question so it clearly saysencfs
is not an option. Regardless, I do hope you'll get an answer that fits you. Good luck.
– Kamil Maciorowski
Jan 21 at 10:45
add a comment |
Is 7zip a must? Choose the right tool. EncFS seems to be it.
- Install it. In Debian:
apt-get install encfs
. Create two directories:
mkdir encrypted mountpoint
.
Run the tool:
encfs "$PWD/encrypted" "$PWD/mountpoint"
Note you need
$PWD/
instead of./
becauseencfs
doesn't accept relative paths (unless-f
is used).
Proceed as instructed to choose encryption, password.
Copy or move all directories and files you want to encrypt to
./mountpoint
. Encrypted directories and files will appear in the./encrypted
directory.
Unmount:
fusermount -u ./mountpoint
You can now copy/move/rename/tar/whatever the ./encrypted
directory as a whole. Note there is a hidden .xml
file inside. The file includes the (password protected) key which is crucial, so don't lose it. It's possible to store the file separetely (read about ENCFS6_CONFIG
variable in man 1 encfs
).
To access the original files, repeat step 3, provide the right password. Work with files under the chosen mountpoint: read, add, remove, modify, anything goes. Finally unmount with fusermount -u
like in step 6.
Notes:
encfs
is FUSE (filesystem in userspace). See Why FUSE might be considered insecure on server?
- There are also EncFS-specific security concerns.
Is 7zip a must? Choose the right tool. EncFS seems to be it.
- Install it. In Debian:
apt-get install encfs
. Create two directories:
mkdir encrypted mountpoint
.
Run the tool:
encfs "$PWD/encrypted" "$PWD/mountpoint"
Note you need
$PWD/
instead of./
becauseencfs
doesn't accept relative paths (unless-f
is used).
Proceed as instructed to choose encryption, password.
Copy or move all directories and files you want to encrypt to
./mountpoint
. Encrypted directories and files will appear in the./encrypted
directory.
Unmount:
fusermount -u ./mountpoint
You can now copy/move/rename/tar/whatever the ./encrypted
directory as a whole. Note there is a hidden .xml
file inside. The file includes the (password protected) key which is crucial, so don't lose it. It's possible to store the file separetely (read about ENCFS6_CONFIG
variable in man 1 encfs
).
To access the original files, repeat step 3, provide the right password. Work with files under the chosen mountpoint: read, add, remove, modify, anything goes. Finally unmount with fusermount -u
like in step 6.
Notes:
encfs
is FUSE (filesystem in userspace). See Why FUSE might be considered insecure on server?
- There are also EncFS-specific security concerns.
answered Jan 21 at 6:55
Kamil MaciorowskiKamil Maciorowski
27k155982
27k155982
Cannot use encfs on this device, otherwise I would as I used to before.
– Vesa
Jan 21 at 10:02
@Vesa It's somewhat disappointing you knew aboutencfs
and you knew you can't use it now, still you didn't explicitly ruled it out. I did notice you're asking about a 7zip solution; but sticking to some tool is often a Y in XY problem, while good answers should concentrate on X and this is what I was trying to do. The answer will stay (with other users in mind), unless you change the question so it clearly saysencfs
is not an option. Regardless, I do hope you'll get an answer that fits you. Good luck.
– Kamil Maciorowski
Jan 21 at 10:45
add a comment |
Cannot use encfs on this device, otherwise I would as I used to before.
– Vesa
Jan 21 at 10:02
@Vesa It's somewhat disappointing you knew aboutencfs
and you knew you can't use it now, still you didn't explicitly ruled it out. I did notice you're asking about a 7zip solution; but sticking to some tool is often a Y in XY problem, while good answers should concentrate on X and this is what I was trying to do. The answer will stay (with other users in mind), unless you change the question so it clearly saysencfs
is not an option. Regardless, I do hope you'll get an answer that fits you. Good luck.
– Kamil Maciorowski
Jan 21 at 10:45
Cannot use encfs on this device, otherwise I would as I used to before.
– Vesa
Jan 21 at 10:02
Cannot use encfs on this device, otherwise I would as I used to before.
– Vesa
Jan 21 at 10:02
@Vesa It's somewhat disappointing you knew about
encfs
and you knew you can't use it now, still you didn't explicitly ruled it out. I did notice you're asking about a 7zip solution; but sticking to some tool is often a Y in XY problem, while good answers should concentrate on X and this is what I was trying to do. The answer will stay (with other users in mind), unless you change the question so it clearly says encfs
is not an option. Regardless, I do hope you'll get an answer that fits you. Good luck.– Kamil Maciorowski
Jan 21 at 10:45
@Vesa It's somewhat disappointing you knew about
encfs
and you knew you can't use it now, still you didn't explicitly ruled it out. I did notice you're asking about a 7zip solution; but sticking to some tool is often a Y in XY problem, while good answers should concentrate on X and this is what I was trying to do. The answer will stay (with other users in mind), unless you change the question so it clearly says encfs
is not an option. Regardless, I do hope you'll get an answer that fits you. Good luck.– Kamil Maciorowski
Jan 21 at 10:45
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1396477%2fis-it-possible-to-encrypt-all-files-in-a-folder-including-their-file-names-but-t%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please clarify your requirements: why do you need to avoid compression?
– grawity
Jan 21 at 8:17
Did you think of encrypting the filenames in an extra step as simple string encryption?
– Julian F. Weinert
Jan 21 at 16:43