Score:1

Password protect a folder

bo flag

I have several files in a folder. I want to encrypt that folder. What's the way I could do it? I tried the following:

Used the command zip with encrypt option. This does encrypt the files. But the files are viewable inside the zip folder. Only when you click on the individual file does it ask for the password.

Is there a way to set passwords at the folder level? I am using this command:

zip --encrypt form.zip folder

I am using Ubuntu 20.04.1 LTS as WSL on windows 11.

Mihir avatar
jp flag
You can use Cryptkeeper for the encryption.
nicku avatar
bo flag
@guiverc I am using WSL. May be that is the reason? Or probably I need to update it
Score:2
us flag
  1. Install gpg

    sudo apt install -y gnupg
    
  2. tar the directory and encrypt it with gpg...

    tar czvf - folder | gpg --symmetric --cipher-algo aes256 -o form.tar.gz.gpg
    

    you'll be prompted to set a passphrase

  3. If you want to extract files from the encrypted tar then you'd run

    gpg -d form.tar.gz.gpg | tar xzvf -
    

    you'll be prompted to enter that same passphrase you entered in step 2 before the files can be extracted

Score:0
sy flag

gpg can also be used to encrypt single files from the directory your in with

gpg -c filename

-c requires a passphrase and encrypts with AES128 Symmetric Cipher, then use

gpg filename.gpg

with the password you set to extract it to the working directory.

To know which encryption you have to use just type gpg --version

Frankly, I think the easiest way forward if multiple people have access to your login, which to be honest they shouldn't, is to create an account on your PC only you have access to and create passworded network shares to the individual folders you want to share, but be secure.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.