// HANDS-ON SLACKWARE LAB · BEGINNER FRIENDLY

Encrypt your first file with GnuPG.

Your privacy toolkit starts in the terminal. In this beginner lab you’ll create a harmless test file, protect it with a passphrase, decrypt it and check that everything worked — all on Slackware Linux.

Slackware 15.0Beginner · about 12 minutesUpdated 9 Nov 2026No root privileges required
darkpc@slackware: ~/darkpc-gpg-lab
$ gpg --version # Your first encrypted practice file $ gpg --symmetric --cipher-algo AES256 \ --output sample-note.txt.gpg sample-note.txt # Passphrase prompt appears in your terminal or a dialog $ gpg --output restored-note.txt \ --decrypt sample-note.txt.gpg # Stay curious. Keep learning. Stay legal.
BEFORE YOU BEGIN

Encryption, explained without the jargon

GnuPG (GNU Privacy Guard) is a free tool that can encrypt files and verify digital signatures. Here we use symmetric encryption: one strong passphrase protects a file and is required to unlock it. Later you can explore public-key encryption for exchanging files with other people.

Good uses for this lab

Protecting your own legal documents, creative work, research notes, or backup copies — starting with a harmless sample text file.

Important privacy reality

Encryption is not anonymity, a replacement for backups, or a way to make unlawful material lawful. The source file remains unencrypted unless you separately manage it. A forgotten passphrase may mean permanent loss of access.

DARKPC LAB / 01

Check GnuPG

Make sure the tool is available before you begin.

$ Find the command
command -v gpg
gpg --version

On a typical full Slackware 15.0 installation, GnuPG is already present. If the command is missing, check that the gnupg package is installed. No root access is needed for the rest of this tutorial.

DARKPC LAB / 02

Make a safe practice folder

We’ll work in a fresh directory with a harmless demonstration note.

$ Create the lab
mkdir -p "$HOME/darkpc-gpg-lab"
cd "$HOME/darkpc-gpg-lab"
printf "Hello from DarkPC!\n" > sample-note.txt
cat sample-note.txt

All following commands assume that you remain inside ~/darkpc-gpg-lab. We use a simple sample note, not real private information.

DARKPC LAB / 03

Encrypt your first file

Give GnuPG a file and a strong passphrase.

$ Encrypt with AES-256
gpg --symmetric --cipher-algo AES256 --output sample-note.txt.gpg sample-note.txt

GnuPG will ask for a passphrase through a terminal or pinentry dialog. Choose a long, unique passphrase. Do not type it directly into a shell command or post it in screenshots.

$ Check the new file
ls -lh sample-note.txt*

You should see both the original sample-note.txt and an encrypted sample-note.txt.gpg. GnuPG does not automatically remove the original.

DARKPC LAB / 04

Restore and verify

Learn to decrypt safely without overwriting your original.

$ Decrypt into a new filename
gpg --output restored-note.txt --decrypt sample-note.txt.gpg

Enter your passphrase if requested. GnuPG may temporarily cache it in gpg-agent, so a repeated command may not prompt again.

$ Compare the files
cmp sample-note.txt restored-note.txt && echo "Success: the files match"

If the files are identical, cmp prints nothing, followed by the success message from echo. This checks our practice workflow without changing the originals.

DARKPC LAB / 05

What about several files?

GnuPG encrypts file contents; you can bundle multiple files into an archive first.

$ Create and encrypt an example archive
tar -czf sample-archive.tar.gz sample-note.txt
gpg --symmetric --cipher-algo AES256 --output sample-archive.tar.gz.gpg sample-archive.tar.gz

An encrypted archive can contain several files, but the unencrypted .tar.gz is still on disk. For this exercise, leave it in the practice folder so you can inspect how the process works.

$ Decrypt the archive
gpg --output recovered-archive.tar.gz --decrypt sample-archive.tar.gz.gpg
tar -tzf recovered-archive.tar.gz

The last command lists archive contents without extracting them. For real documents, choose a safe extraction location and inspect filenames first.

HELP / TROUBLESHOOTING

If something doesn't work

“gpg: command not found”

Check the installed GnuPG package and your PATH. A full Slackware installation normally includes it. Ask an administrator before installing packages on shared machines.

No passphrase prompt on a text console?

GnuPG 2 uses gpg-agent and a pinentry program. On a local terminal you can try the command below, then repeat the encryption command. If your setup lacks a console pinentry program, install/configure a compatible one using trusted Slackware packages.

$ Point GPG at your current terminal
export GPG_TTY="$(tty)"

This only sets a session environment variable; it does not change the file or disable passphrase protection.

Decrypt command prints a warning about cached passwords

GnuPG may cache a passphrase briefly in its agent. Do not assume another command will always require you to type the passphrase again. Lock your account when stepping away.

“File exists” when restoring

Choose a new output filename. Avoid overwriting your original documents. Do not add --yes just to silence a safety prompt.

TAKEAWAYS

Five habits worth keeping

  • Practise on copies and harmless sample files first.
  • Use a long, unique passphrase and keep a secure recovery plan.
  • Verify decryption before relying on an encrypted backup.
  • Remember that originals and unencrypted archives remain readable.
  • Keep your Slackware system and GnuPG packages updated.
Mission complete!

You made and recovered an encrypted file without changing system settings. That's one more useful Unix skill in your toolkit. 🦍

Learn more from the official docs

← Back to all DarkPC guides