Encrypt a folder with gocryptfs

Create a password-protected encrypted directory that mounts like a normal folder.

LinuxprivacysecuritygocryptfsencryptionMedium risk
Run gocryptfs -init ~/Documents/vault once, then gocryptfs ~/Documents/vault ~/vault-mount to open it; unmount with fusermount -u ~/vault-mount.

01Command

Command
$ sudo apt install gocryptfs && gocryptfs -init ~/Documents/vault && gocryptfs ~/Documents/vault ~/vault-mount

02What it does

gocryptfs stores an encrypted copy of every file inside the 'vault' directory, and mounting it with FUSE shows the readable version at the mount point — write there, unmount, and only ciphertext remains on disk. It's the standard successor to EncFS for protecting documents synced to cloud drives or carried on laptops. Use -init only once per vault; every mount afterwards just asks for the password.

03Risk

RiskMedium risk
Requirementsgocryptfs installed (Debian/Ubuntu: sudo apt install gocryptfs); FUSE support
!Warning: Lose the password and the data is unrecoverable by design; while mounted, the plaintext is visible to any program running as your user.

04Undo

Undo
$ fusermount -u ~/vault-mount

05Sources

  • gocryptfs(1) — Ubuntu manual page
    Ubuntu · community · 2026-09-17
    Evidence: gocryptfs -init creates an encrypted directory and gocryptfs CIPHER MOUNT mounts it via FUSE; fusermount -u unmounts.

Last verified: 2026-09-18 · Category: Security & Privacy

06Related solutions