--- title: age โ€” simple file encryption tool date: 2026-10-18 time: 12:00 model: admin category: programs author_type: human summary: A file encryption tool that is extremely simple to use compared to GnuPG. tags: program, User and Security Management, age --- **๐Ÿ’ฌ "age Command"** age is an **easy-to-use file encryption tool**. It is a file encryption tool with usage that is extremely simple compared to GnuPG. It encrypts directly with an SSH public key (no need to generate a GPG key). It has no dependencies as a single binary. - **Concept**: Encrypts directly with an SSH public key (no need to generate a GPG key). - **Main Feature**: It has no dependencies as a single binary. - **Advantage**: Supports various key types like X25519, SSH, and YubiKey. - **Usage**: Usage is much simpler compared to GPG. ## Installation and Download age is installed via a package manager or the official script. | Environment | Command | | --- | --- | | Ubuntu 24.04+ | sudo apt install age | | RHEL / Fedora | sudo dnf install age | | macOS (brew) | brew install age | | Official Binary | github.com/FiloSottile/age/releases | | Verify | age --version | Verify the installation using `age --version`. ## Commonly Used Options | Option | Description | | --- | --- | | -e, --encrypt | Encrypt (default) | | -d, --decrypt | Decrypt | | -r, --recipient | Specify the public key | | -i, --identity | Specify the private key file | | -p, --passphrase | Passphrase-based encryption | ## 3 Essential Command Combinations - `age -r age1... file.txt > file.txt.age` โ€” Encrypt with a public key - `age -d -i key.txt file.txt.age > file.txt` โ€” Decrypt with a private key - `age -r $(cat ~/.ssh/id_ed25519.pub) secrets.env` โ€” Use an SSH public key **๐Ÿ’ฌ "Show me an example of using age on a real server"** Here is a step-by-step guide for common situations encountered on a live production server. ### Step 1 ยท Key Generation Generate an age key pair. ``` age-keygen -o key.txt ``` ### Step 2 ยท Encryption Encrypt a file with a public key. ``` age -r age1... secrets.env > secrets.env.age ``` ### Step 3 ยท Decryption Verification Decrypt with the private key. ``` age -d -i key.txt secrets.env.age ``` ## Actual Execution Output This is the result of generating an age key and encrypting a file with a public key. ![age command execution result](https://games.aidebatehub.com/assets/age-demo.png) Live production server ## How It's Used in Practice ### 1. Backup Encryption with SSH Key **Situation** โ€” Encrypt a file with an SSH public key. ``` age -r $(cat ~/.ssh/id_ed25519.pub) secrets.env > secrets.env.age ``` **Result** โ€” The secrets.env.age file is created. **Key Point** โ€” Encryption is done directly with the SSH key, so no GPG key generation is needed. ### 2. Decryption on a Remote Server **Situation** โ€” Decrypt an encrypted file remotely. ``` scp secrets.env.age root@backup:/backups/ ssh backup 'age -d -i /root/key.txt /backups/secrets.env.age > /backups/secrets.env' ``` **Result** โ€” Decryption is completed on the remote server. **Key Point** โ€” The private key is stored only on the remote server. ## Actual Execution Output This is the result of decrypting with age on a remote server. ![age command execution result 2](https://games.aidebatehub.com/assets/age-demo2.png) Live production server ## Important Notes - Never commit the private key (key.txt) to git. This would nullify the encryption. - Lost key = lost data. Backing up the private key is essential. - age also supports symmetric encryption (passphrase), but the public key method is superior in terms of reusability and manageability. --- Source (HTML): https://games.aidebatehub.com/programs/linux/security/age.html This file is an auto-generated Markdown twin of the DevHub document.