this post was submitted on 05 Sep 2025
14 points (100.0% liked)
Linux Questions
2603 readers
1 users here now
Linux questions Rules (in addition of the Lemmy.zip rules)
- stay on topic
- be nice (no name calling)
- do not post long blocks of text such as logs
- do not delete your posts
- only post questions (no information posts)
Tips for giving and receiving help
- be as clear and specific
- say thank you if a solution works
- verify your solutions before posting them as facts.
Any rule violations will result in disciplinary actions
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
The standard Linux command for encryption is
gpg
. And in this case, because you want to encrypt with password, it'sgpg -c
, more specifically.That can only encrypt one file, though. So, what you do is turn it into a package (like .zip on Windows)
This is done with
tar -cvzf
.So:
tar -cvzf trumpisafascist.tar.gz name_of_folder_to_encrypt
, thengpg -c trumpisafascist.tar.gz
And, Linux enables you to pack everything on one line:
tar -cvzf - foldernamehere | gpg -c > trumpisafascist.tar.gz.gpg
Of course, even easier is to make these two text files:
Save this in a text file as encrypt.sh:
Save this in a textfile as unencrypt.sh:
&& means "do the following only if the previous command was executed successfully".
Then say
mkdir unencryptedfolder
(to create a folder with that name; if you want to use a different name for your folder, update that same name in the two files!)chmod +x encrypt.sh
andchmod +x unencrypt.sh
(to make those files executable by double-clicking them). These things can also be done by pointing and clicking on most Linux distributions. Right click the encrypt.sh file, choose Properties, and give "Others" the right to execute the file. Should work usually, but of course the text commands will.work always.Now everything you have in the folder unencryptedfolder gets encrypted and the folder deleted when you double-click encrypt.sh, and if you double-click unencrypt.sh, then the file is unencrypted and extracted, after which the encrypted file is deleted. If double-clicking doesn't work, you can also navigate to the usb drive on command line and say
./encrypt.sh
and./unencrypt.sh
.This uses gnupg to encrypt the file, tar to make a package and gzip to compress that package. You should be able to find a windows program for unencrypting gnupg files, and I think windows can probably readily extract a gzipped tar file? If not, then this needs to be altered to use .zip instead. Probably works by using zip and unzip instead of tar -cvzf and tar -xvzf, but I am not sure and don't have a computer around for trying.
Also, always remember to fight fascism!