Is it possible to encrypt all files in a folder including their file names but totally without compression...












1















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.










share|improve this question

























  • 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
















1















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.










share|improve this question

























  • 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














1












1








1








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 21 at 10:04







Vesa

















asked Jan 21 at 5:54









VesaVesa

175211




175211













  • 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











  • 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










2 Answers
2






active

oldest

votes


















1














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






share|improve this answer
























  • 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



















0














Is 7zip a must? Choose the right tool. EncFS seems to be it.




  1. Install it. In Debian: apt-get install encfs.

  2. Create two directories: mkdir encrypted mountpoint.



  3. Run the tool:



    encfs "$PWD/encrypted" "$PWD/mountpoint"


    Note you need $PWD/ instead of ./ because encfs doesn't accept relative paths (unless -f is used).



  4. Proceed as instructed to choose encryption, password.


  5. Copy or move all directories and files you want to encrypt to ./mountpoint. Encrypted directories and files will appear in the ./encrypted directory.



  6. 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.






share|improve this answer
























  • 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











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
});


}
});














draft saved

draft discarded


















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









1














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






share|improve this answer
























  • 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
















1














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






share|improve this answer
























  • 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














1












1








1







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






share|improve this answer













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







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 21 at 7:55









David DaiDavid Dai

1,739820




1,739820













  • 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











  • @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













0














Is 7zip a must? Choose the right tool. EncFS seems to be it.




  1. Install it. In Debian: apt-get install encfs.

  2. Create two directories: mkdir encrypted mountpoint.



  3. Run the tool:



    encfs "$PWD/encrypted" "$PWD/mountpoint"


    Note you need $PWD/ instead of ./ because encfs doesn't accept relative paths (unless -f is used).



  4. Proceed as instructed to choose encryption, password.


  5. Copy or move all directories and files you want to encrypt to ./mountpoint. Encrypted directories and files will appear in the ./encrypted directory.



  6. 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.






share|improve this answer
























  • 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
















0














Is 7zip a must? Choose the right tool. EncFS seems to be it.




  1. Install it. In Debian: apt-get install encfs.

  2. Create two directories: mkdir encrypted mountpoint.



  3. Run the tool:



    encfs "$PWD/encrypted" "$PWD/mountpoint"


    Note you need $PWD/ instead of ./ because encfs doesn't accept relative paths (unless -f is used).



  4. Proceed as instructed to choose encryption, password.


  5. Copy or move all directories and files you want to encrypt to ./mountpoint. Encrypted directories and files will appear in the ./encrypted directory.



  6. 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.






share|improve this answer
























  • 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














0












0








0







Is 7zip a must? Choose the right tool. EncFS seems to be it.




  1. Install it. In Debian: apt-get install encfs.

  2. Create two directories: mkdir encrypted mountpoint.



  3. Run the tool:



    encfs "$PWD/encrypted" "$PWD/mountpoint"


    Note you need $PWD/ instead of ./ because encfs doesn't accept relative paths (unless -f is used).



  4. Proceed as instructed to choose encryption, password.


  5. Copy or move all directories and files you want to encrypt to ./mountpoint. Encrypted directories and files will appear in the ./encrypted directory.



  6. 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.






share|improve this answer













Is 7zip a must? Choose the right tool. EncFS seems to be it.




  1. Install it. In Debian: apt-get install encfs.

  2. Create two directories: mkdir encrypted mountpoint.



  3. Run the tool:



    encfs "$PWD/encrypted" "$PWD/mountpoint"


    Note you need $PWD/ instead of ./ because encfs doesn't accept relative paths (unless -f is used).



  4. Proceed as instructed to choose encryption, password.


  5. Copy or move all directories and files you want to encrypt to ./mountpoint. Encrypted directories and files will appear in the ./encrypted directory.



  6. 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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 21 at 6:55









Kamil MaciorowskiKamil Maciorowski

27.8k156184




27.8k156184













  • 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



















  • 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

















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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Plaza Victoria

In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...