# gocryptfs

From ArchWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Related articles

- Data-at-rest encryption
- Encfs

From gocryptfs:

  gocryptfs uses file-based encryption that is implemented as a mountable FUSE filesystem. Each file in gocryptfs is stored one corresponding encrypted file on the hard disk.
  The highlights are: Scrypt password hashing, GCM encryption for all file contents, EME wide-block encryption for file names with a per-directory IV.

See the gocryptfs project home for further introduction of its features, benchmarks, etc. See Data-at-rest encryption#Comparison table for an overview of alternative methods and EncFS for the direct alternative.

## Installation

Install gocryptfs or gocryptfs-gitAUR.

As a FUSE filesystem, gocryptfs is fully configurable by the user and stores its configuration files in the user's directory paths.

## Usage

See gocryptfs(1) and its examples first.

Warning:

- To achieve its design goal of authenticated encryption, gocryptfs implements a AES-EME encryption mode (for filenames, not the content). While this mode is not widely used/audited yet, it offers integrity protection for the data, a feature not available for direct alternative encryption methods.
- See the project's tracking bug report regarding findings of the first security audit for more information.

Tip: Execute `gocryptfs -speed` to test throughput for available encryption methods. Note the slowest `AES-SIV-512-Go` mode is required (and automatically selected) for reverse mode.

### Example using reverse mode

A major application for file-based encryption methods are encrypted backups. FUSE-based filesystems are flexible for this, since they allow a wide array of backup destinations using standard tools. For example, a gocryptfs-encrypted FUSE mount point can be easily created directly on a Samba/NFS share or Dropbox location, synchronized to a remote host with rsync, or just be manually copied to a remote backup storage.

Warning: By default the gocryptfs.conf file is stored within the backup directory for convenience. If you upload the gocryptfs.conf file to an online source, your backup can be decrypted if your password is known or cracked. Using a strong password will lower the chances of a successful attack. [1] You can choose to use a gocryptfs.conf file from another location by providing the '-config' option along with the path to your config file.

The reverse mode of gocryptfs is particularly useful for creating encrypted backups, since it requires virtually no extra storage capacity on the machine to back up.

The following shows an example of user archie creating a backup of `/home/archie`:

First, archie initializes the configuration for the home directory:

    $ gocryptfs -init -reverse /home/archie

    Choose a password for protecting your files.
    Password:
    ...

Second, an empty directory for the encrypted view of the home directory is created and mounted:

    $ mkdir /tmp/crypt
    $ gocryptfs -reverse /home/archie /tmp/crypt
    Password:
    Decrypting master key

    Your master key is:
    ...
    Filesystem mounted and ready.
    $

Tip: The `-exclude folder` option is available during the mount. Note that with software like rsync errors or warnings may occur if exclusions are done later only.[2]

Third, archie creates a backup of the encrypted directory, a simple local copy for this example:

    $ cp -a /tmp/crypt /tmp/backup

and done.

The encrypted directory can stay mounted for the user session, or be unmounted manually:

    $ fusermount -u /tmp/crypt
    $ rmdir /tmp/crypt

To restore from the encrypted backup, a plain-text view is mounted using gocryptfs's normal mode:

    $ mkdir /tmp/restore
    $ gocryptfs /tmp/backup/ /tmp/restore
    Password:
    Decrypting master key
    ...
    Filesystem mounted and ready.
    $

Now the required files can be restored.

## User friendly mounting

### Mount using gocryptfs-ui

A bash script gocryptfs-ui provides a simple zenity GUI around the gocryptfs command line utility to mount and unmount an encrypted directory. It includes a desktop launcher. Install it from gocryptfs-uiAUR.

## See also

- A first security audit of gocryptfs
- RFC 5297 Synthetic Initialization Vector (SIV) Authenticated Encryption Using the Advanced Encryption Standard (AES)
- gocryptfs-ui (gocryptfs-uiAUR) is a simple GUI for gocryptfs.

Categories:

- Data-at-rest encryption
- FUSE