summaryrefslogtreecommitdiff
path: root/tech/how to encrypt a file or directory in linux.txt
blob: ebb28c84fc968e09bdd24a6433cb662761a30a9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
title: encryption - How to encrypt a file or directory in Linux?
date: 2015-10-03T14:06:45Z
source: http://superuser.com/questions/249497/how-to-encrypt-a-file-or-directory-in-linux
tags: security

---

I think it would be gpg. The syntax for files and directories differs though.

## Encryption

For files(outputs filename.gpg):

    gpg -c filename

For dirs:

    gpg-zip -c -o file.gpg dirname

## Decryption

For files(outputs filename.gpg):

    gpg filename.gpg

For dirs:

    gpg-zip -d file.gpg

Edit: Corrected as @Mk12 pointed out the mistake of compression/decompression for encryption/decryption.