GOCRYPTFS(1)
π GOCRYPTFS π β the gocryptfs manual, bestie edition
okay so. bestie. you're holding the manual page for gocryptfs, and I need you to know this is genuinely one of my fave little tools, so let's get into it. π«Ά
πΈ NAME πΈ
gocryptfs β create or mount an encrypted filesystem
β¨ SYNOPSIS β¨
like, the vibes are: it depends what you're doing. pick your adventure π
π Initialize new encrypted filesystem
gocryptfs -init [OPTIONS] CIPHERDIR
π¦ Mount
gocryptfs [OPTIONS] CIPHERDIR MOUNTPOINT [-o COMMA-SEPARATED-OPTIONS]
π Unmount
fusermount -u MOUNTPOINT
π Change password
gocryptfs -passwd [OPTIONS] CIPHERDIR
β Check consistency
gocryptfs -fsck [OPTIONS] CIPHERDIR
π Show filesystem information
gocryptfs -info [OPTIONS] CIPHERDIR
π DESCRIPTION π
so gocryptfs is an encrypted overlay filesystem written in Go. The way it works is: your encrypted files live in CIPHERDIR, and then you can get a plain-text view of them by mounting the filesystem at MOUNTPOINT. it's giving β¨magicβ¨ but it's literally just filesystems.
gocryptfs was inspired by encfs(1) and it's lowkey on a mission to fix the security issues encfs had while still being fast. we love a redemption arc. π
π₯ ACTION FLAGS π₯
okay bestie, important: unless you pass one of these action flags, the default action is to mount a filesystem (peep the SYNOPSIS if you missed it). so no flag = mounting. periodt.
π -fsck
Check CIPHERDIR for consistency. And if corruption is found?? the exit code is 26. no cap. π
π
-h, -help
Print a short help text that shows the more-often used options. the little quick-look version.
π¦ -hh
Long help text, shows all available options. every single one. she's thorough.
π -info
Pretty-print the contents of the config file in CIPHERDIR for human consumption, stripping out sensitive data. so you can look at it without exposing anything spicy. π
Example:
$ gocryptfs -info my_cipherdir
Creator: gocryptfs v2.0-beta2
FeatureFlags: GCMIV128 HKDF DirIV EMENames LongNames Raw64
EncryptedKey: 64B
ScryptObject: Salt=32B N=65536 R=8 P=1 KeyLen=32
πΈ -init
Initialize encrypted directory. the very first step, the origin story. β¨
π -passwd
Change the password. She'll ask for the old password, check if it is correct, and ask for a new one. very polite about it.
This can be used together with -masterkey if you forgot the password but know the master key. Note that without the old password, gocryptfs cannot tell if the master key is correct and will overwrite the old one without mercy. π literally no mercy. It will, however, create a backup copy of the old config file as gocryptfs.conf.bak. Delete it after you have verified that you can access your files with the new password. please don't forget that part bestie.
β -speed
Run crypto speed test. Benchmark Go's built-in GCM against OpenSSL (if available). The library that will be selected on -openssl=auto (the default) is marked as such. it's a little race and the winner gets a crown π
π -version
Print version and exit. The output contains three fields separated by ;. Example: gocryptfs v1.1.1-5-g75b776c; go-fuse 6b801d3; 2016-11-01 go1.7.3. So field 1 is the gocryptfs version, field 2 is the version of the go-fuse library, field 3 is the compile date and the Go version that was used. three little fields, all separated by ;. iykyk.
π INIT OPTIONS π
Available options for -init are listed below. Usually, you don't need any. Defaults are fine. fr fr, the defaults ate.
π -aessiv
Use the AES-SIV encryption mode. This is slower than AES-GCM but is secure with deterministic nonces as used in -reverse mode.
Run gocryptfs -speed to find out if and how much slower. (spoiler: she'll tell you the numbers, no guessing here)
π -deterministic-names
Disable file name randomisation and creation of gocryptfs.diriv files. This can prevent sync conflicts when synchronising files, but leaks information about identical file names across directories ("Identical names leak" in https://nuetzlich.net/gocryptfs/comparison/#file-names ). so like, tradeoffs, bestie.
The resulting gocryptfs.conf has "DirIV" missing from "FeatureFlags".
π -devrandom
Obsolete and ignored on gocryptfs v2.2 and later. she's retired, she's living her best life, she does nothing now.
See https://github.com/rfjakob/gocryptfs/commit/f3c777d5eaa682d878c638192311e52f9c204294 and https://github.com/rfjakob/gocryptfs/issues/596 for background info.
π§ -hkdf
Use HKDF to derive separate keys for content and name encryption from the master key. Default true. slay.
π
-longnamemax
integer value, allowed range 62...255
Hash file names that (in encrypted form) exceed this length. The default is 255, which aligns with the usual name length limit on Linux and provides best performance.
However, online storage may impose lower limits on file name and/or path length. In this case, setting -longnamemax to a lower value can be helpful.
The lower the value, the more extra .name files must be created, which slows down directory listings. so like, more files, more waiting. π
Values below 62 are not allowed as then the hashed name would be longer than the original name. that would be giving nonsense.
Example:
-longnamemax 100
πΈ -plaintextnames
Do not encrypt file names and symlink targets. just... out there. raw. π
β -raw64
Use unpadded base64 encoding for file names. This gets rid of the trailing "\=\=". A filesystem created with this option can only be mounted using gocryptfs v1.2 and higher. Default true.
π¦ -reverse
Reverse mode shows a read-only encrypted view of a plaintext directory. Implies -aessiv.
If you want to mount the encrypted view using -masterkey, you must specify -aessiv. important!! don't skip that part!!
π -xchacha
Use XChaCha20-Poly1305 file content encryption. This should be much faster than AES-GCM on CPUs that lack AES acceleration. so if your CPU isn't built different for AES, this is your girl. π₯
Run gocryptfs -speed to find out if and how much faster.
π MOUNT OPTIONS π
okay bestie so these are all the options you can throw at gocryptfs when you're mounting. and likeβ¦ you probably don't need any of them?? the defaults are fine, the defaults are slaying, leave them alone. β¨ but if you're curious, here's the whole menu. π
-aclβ turns on ACL enforcement. so like, if you wanna use ACLs, you literally have to flip this on. no option, no ACLs, that's the deal. π-allow_otherβ by default the Linux kernel is super gatekeepy and won't let any other user (yes, even root π) touch a mounted FUSE filesystem. setting this option lets other users in, subject to normal file permission checking. it only works ifuser_allow_otheris set in/etc/fuse.conf. this option is equivalent toallow_otherplusdefault_permissionsas described infuse(8).-badname stringβ so when gocryptfs runs into a "bad" file name (can't decrypt it, or it decrypts into garbage ποΈ), it logs a warning and hides that file from the plaintext view. with-badnameyou get to pick which "bad" names still show up in the plaintext view instead of being hidden. bad files getGOCRYPTFS_BAD_NAMEappended to their name. it's a glob pattern, and you can pass it multiple times for multiple patterns. examples, bestie:
Dropbox sync conflicts:
-badname '*conflicted copy*'
Syncthing sync conflicts:
-badname '*.sync-conflict*'
Show all invalid filenames:
-badname '*'
-context stringβ sets the SELinux context. seemount(8)for the deets. this option was added for compatibility with xfstests, which sets it via-o context="system_u:object_r:root_t:s0". β οΈ only works when you mount as root β otherwise you get this lil error fromfusermount3:
fusermount3: unknown option 'context="system_u:object_r:root_t:s0"'
-ctlsock stringβ makes a control socket at whatever location you point it at. the socket can be used to decrypt and encrypt paths inside the filesystem. π when you use this, make sure the directory you drop the socket in is not world-accessible, fr fr. like/run/user/UID/my.socketwould be a good spot.-dev,-nodevβ enable (-dev) or disable (-nodev) device files in a gocryptfs mount (default:-nodev). if you pass both,-nodevwins, periodt. you need root permissions to use-dev.-e PATH,-exclude PATHβ reverse mode only, bestie: excludes a relative plaintext path from the encrypted view, matching only from the root of the mounted filesystem. can be passed multiple times. example that excludes the directories "Music" and "Movies" from the root directory:
gocryptfs -reverse -exclude Music -exclude Movies /home/user /mnt/user.encrypted
see also -exclude-wildcard, -exclude-from, and the EXCLUDING FILES section. π¦
-ew GITIGNORE-PATTERN,-exclude-wildcard GITIGNORE-PATTERNβ reverse mode only again: excludes paths from the encrypted view usinggitignore(5)syntax, wildcards supported. pass it multiple times for multiple patterns. example to exclude all.mp3files in any directory:
gocryptfs -reverse -exclude-wildcard '*.mp3' /home/user /mnt/user.encrypted
example to to exclude everything but the directory important in the root dir:
gocryptfs -reverse -exclude-wildcard '*' -exclude-wildcard '!/important' /home/user /mnt/user.encrypted
see also -exclude-from and the EXCLUDING FILES section.
-exclude-from FILEβ reverse mode only: reads gitignore patterns from a file. can be passed multiple times. example:
gocryptfs -reverse -exclude-from ~/crypt-exclusions /home/user /mnt/user.encrypted
see also -exclude, -exclude-wildcard, and the EXCLUDING FILES section.
-exec,-noexecβ enable (-exec) or disable (-noexec) executables in a gocryptfs mount (default:-exec). if both are specified,-noexectakes precedence.-fg,-fβ stay in the foreground instead of forking away. for compatibility,-fis also accepted, but-fgis the preferred one (it's giving main character π ). unless-notifypidis also passed, the logs go to stdout and stderr instead of syslog.-force_owner stringβ if you give it a string shaped likeuid:gid(where bothuidandgidget substituted with positive integers), it presents all files as owned by that uid and gid, no matter what their actual ownership is. impliesallow_other. tbh this is rarely what you want: you should usually run gocryptfs as the account that owns the backing-store files, which should usually be the same account that's meant to access the decrypted content. one case where it can be useful is when your content lives on a filesystem that doesn't properly support UNIX ownership and permissions. π«Ά-forcedecodeβ obsolete and ignored on gocryptfs v2.2 and later. it's a fossil, bestie. π seehttps://github.com/rfjakob/gocryptfs/commit/d023cd6c95fcbc6b5056ba1f425d2ac3df4abc5afor what it was and why it got dropped.-fsname stringβ overrides the filesystem name (that's the first column indf -T). can also be passed as-o fsname=and is equivalent to libfuse's option of the same name. by default,CIPHERDIRis used.-fusedebugβ enables fuse library debug output. π-i duration,-idle durationβ forward mode only: automatically unmounts the filesystem if it's been idle for the specified duration. durations can be written like500sor2h45m.0(the default) means stay mounted indefinitely. when a process has open files or its working directory in the mount, that keeps it not-idle indefinitely. no nap time for you. π΄-kernel_cacheβ enables thekernel_cacheoption of the FUSE filesystem. seefuse(8)for details.-koβ passes additional mount options straight to the kernel (comma-separated list). FUSE filesystems get mounted withnodev,nosuidby default. if gocryptfs runs as root, you can enable device files by passing the opposite mount option,dev, and if you want suid-binaries, passsuid.ro(equivalent to passing the-rooption) andnoexecmay also be interesting. for the complete list, see the section FILESYSTEM-INDEPENDENT MOUNT OPTIONS inmount(8). on MacOS,localenables volume-based trash if you have a.Trashesfolder in the root of your volume (it might need to be manually created) β but heads up,localis marked as "experimental" in osxfuse.noapplexattrandnoappledoublemay also be interesting. π note that unlike-o,-kois a regular option and must be passed BEFORE the directories. example:
gocryptfs -ko noexec /tmp/foo /tmp/bar
-longnamesβ stores names longer than 175 bytes in extra files (default true). this flag is only useful when recovering very old gocryptfs filesystems (gocryptfs v0.8 and earlier) using-masterkey. otherwise it's ignored and stays at the default. π§-nodevβ see-dev,-nodev.-noexecβ see-exec,-noexec.-nofailβ having thenofailoption in/etc/fstabtells systemd to keep booting normally even if the mount fails (seeman systemd.fstab). the option is ignored by gocryptfs itself and has no effect outside/etc/fstab.-nonemptyβ allows mounting over non-empty directories. FUSE by default says no to this, to prevent accidentally shadowing files. π-nopreallocβ disables preallocation before writing. by default, gocryptfs preallocates the space the next write will take usingfallocate(2)in modeFALLOC_FL_KEEP_SIZE. the preallocation makes sure it can't run out of space in the middle of the write, which would cause the last 4kB block to be corrupt and unreadable. π on ext4, preallocation is fast and causes no noticeable performance hit. unfortunately on Btrfs, preallocation is very slow, especially on rotational HDDs. the-nopreallocoption lets you trade robustness against out-of-space errors for a massive speedup. for benchmarks and more details on the whole situation, seehttps://github.com/rfjakob/gocryptfs/issues/63.-nosuidβ see-suid,-nosuid.-nosyslogβ diagnostic messages normally get redirected to syslog once gocryptfs daemonizes. this option disables that redirection, so messages keep printing to stdout and stderr. π’-notifypid intβ sendsUSR1to the specified process after a successful mount. this is used internally for daemonization.-one-file-systemβ don't cross filesystem boundaries (just like rsync's--one-file-system). mountpoints will appear as empty directories. only applicable to reverse mode. β οΈ limitation: mounted single files (yes, that's possible) are NOT hidden.-rw,-roβ mount the filesystem read-write (-rw, the default) or read-only (-ro). if both are specified,-rotakes precedence.-reverseβ see the-reversesection in INIT OPTIONS. you need to specify the-reverseoption both at-initand at mount. βοΈ-serialize_readsβ the kernel usually submits multiple concurrent reads to service userspace requests and kernel readahead. gocryptfs serves them concurrently and in arbitrary order. on backing storage that performs poorly for concurrent or out-of-order reads (like Amazon Cloud Drive), this behavior can cause very slow read speeds. the-serialize_readsoption does two things: (1) reads get submitted one-by-one (no concurrency) and (2) gocryptfs tries to order the reads by file offset order. the ordering means gocryptfs has to wait a certain time before submitting a read. the serialization introduces extra locking. these factors will limit throughput to below 70MB/s. for more details visithttps://github.com/rfjakob/gocryptfs/issues/92.-sharedstorageβ enables work-arounds so gocryptfs behaves better when the backing storage directory is concurrently accessed by multiple gocryptfs instances. at the moment, it does two things:- Disables
stat()caching so changes to the backing storage show up immediately. - Disables hard link tracking, because the inode numbers on the backing storage aren't stable when files are deleted and re-created behind our back. that would otherwise produce strange "file does not exist" and other errors.
- Disables
when -sharedstorage is active, performance is reduced and hard links cannot be created. and even with this flag set, you may hit occasional problems β running gocryptfs on shared storage doesn't receive as much testing as the usual (exclusive) use-case. please test your workload in advance and report any problems you hit. π«Ά more info: https://github.com/rfjakob/gocryptfs/issues/156
-suid,-nosuidβ enable (-suid) or disable (-nosuid) suid and sgid executables in a gocryptfs mount (default:-nosuid). if both are specified,-nosuidtakes precedence. you need root permissions to use-suid.-zerokeyβ use an all-zero dummy master key. π¨ this option is only intended for automated testing, because it does not provide any security. literally none. do not use it for real stuff, bestie.
β¨ COMMON OPTIONS β¨
Okay bestie, these are the options that show up in more than one action β the multi-hyphenate icons of the flag world π . Each one tells you exactly where it's applicable, so you never have to guess. And again, fr fr: usually you don't need any of them. They're here if you need them, not because you do.
-configstring β Use the specified config file instead ofCIPHERDIR/gocryptfs.conf.
Applies to: all actions that use a config file: mount, -fsck, -passwd, -info, -init.
-cpuprofilestring β Write the CPU profile to the specified file.
Applies to: all actions.
-d,-debugβ Turn on debug output. Spicy extra detail mode.
Applies to: all actions.
-extpassCMD[-extpassARG1...]β Use an external program (likessh-askpass) for the password prompt instead of typing it yourself. The program should return the password on stdout, and gocryptfs strips a trailing newline for you π«Ά. If all you want is to read from a password file, see-passfileinstead.
When -extpass is specified once, the string argument gets split on spaces. For example, -extpass "md5sum my password.txt" will be executed as "md5sum" "my" "password.txt" β which is NOT what you want π.
Specify -extpass twice or more to use the string arguments as-is. For example, you DO want to call md5sum like this: -extpass "md5sum" -extpass "my password.txt".
If you want to prevent splitting on spaces but don't want to pass arguments to your program, use "--", which is accepted by most programs: -extpass "my program" -extpass "--".
Applies to: all actions that ask for a password.
BUG: In-extpass -X, the-Xwill be interpreted as--X. Please use-extpass=-Xto prevent that. See Dash duplication in the BUGS section for details.
-fido2DEVICE_PATH β Use a FIDO2 token to initialize and unlock the filesystem. Usefido2-token -Lto obtain the FIDO2 token device path. For linux, thefido2-toolspackage is needed.
Applies to: all actions that ask for a password.
-fido2-assert-optionOPTION β Options passed tofido2-assertwith the-toption. This option may be specified multiple times, and each time it will add two arguements-tOPTION tofido2-assert. Seeman fido2-assertto check supported options.
Examples:
Creating a filesystem with no pin verification:
gocryptfs -init -fido2 DEVICE_PATH -fido2-assert-option pin=false CIPHERDIR
Creating a filesystem with both user verification and pin verification:
gocryptfs -init -fido2 DEVICE_PATH -fido2-assert-option uv=true -fido2-assert-option pin=true CIPHERDIR
Creating a filesystem with both user presence and user verification:
gocryptfs -init -fido2 DEVICE_PATH -fido2-assert-option up=true -fido2-assert-option uv=true CIPHERDIR
-masterkeystring β Use an explicit master key specified right on the command line, or β if the special value"stdin"is used β read the masterkey from stdin, instead of reading the config file and asking for the decryption password. Emergency vibes only, bestie.
Note that the command line, and with it the master key, is visible to anybody on the machine who can execute "ps -auxwww". Use "-masterkey=stdin" to avoid that risk. π
The masterkey option is meant as a recovery option for emergencies, such as if you have forgotten the password or lost the config file.
Even if a config file exists, it will not be used. All non-standard settings have to be passed on the command line: -aessiv when you mount a filesystem that was created using reverse mode, or -plaintextnames for a filesystem that was created with that option.
Example 1: Mount a filesystem that was created using default options:
gocryptfs -masterkey=6f717d8b-6b5f8e8a-fd0aa206-778ec093-62c5669b-abd229cd-241e00cd-b4d6713d cipher mnt
gocryptfs -masterkey=stdin cipher mnt
Example 2: Mount a gocryptfs -reverse filesystem (note that you must specify -aessiv):
gocryptfs -masterkey=stdin -aessiv cipher mnt
Applies to: all actions that ask for a password.
-memprofilestring β Write the memory profile to the specified file. This is useful when debugging memory usage of gocryptfs. π
Applies to: all actions.
-oCOMMA-SEPARATED-OPTIONS β For compatibility withmount(1), options are also accepted as"-o COMMA-SEPARATED-OPTIONS"at the end of the command line. For example,"-o q,zerokey"is equivalent to passing"-q -zerokey".
Note that you can only use options that are understood by gocryptfs with "-o". If you want to pass special flags to the kernel, you should use "-ko" (kernel option). This is different in libfuse-based filesystems, that automatically pass any "-o" options they do not understand along to the kernel.
Example:
gocryptfs /tmp/foo /tmp/bar -o q,zerokey
Applies to: all actions.
-opensslbool/"auto" β Use OpenSSL instead of built-in Go crypto (default"auto"). Using built-in crypto is 4x slower unless your CPU has AES instructions and you are using Go 1.6+. In mode"auto", gocrypts chooses the faster option. β‘
Applies to: all actions.
-passfileFILE[-passfileFILE2...]β Read the password from the specified plain text file. The file should contain exactly one line (do not use binary files! π«). A warning will be printed if there is more than one line, and only the first line will be used. A single trailing newline is allowed and does not cause a warning.
Pass this option multiple times to read the first line from multiple files. They are concatenated for the effective password.
Example:
echo hello > hello.txt
echo world > world.txt
gocryptfs -passfile hello.txt -passfile world.txt
The effective password will be "helloworld".
Applies to: all actions that ask for a password.
-q,-quietβ Quiet β silence informational messages. π€«
Applies to: all actions.
-scryptnint β gocryptfs uses scrypt for hashing the password when mounting, which protects from brute-force attacks.
-scryptn controls the scrypt cost parameter "N" expressed as scryptn=log2(N). Possible values are -scryptn=10 to -scryptn=28, representing N=2^10 to N=2^28.
Setting this to a lower value speeds up mounting and reduces its memory needs, but makes the password susceptible to brute-force attacks. The default is 16.
The memory usage for scrypt during mounting is as follows:
scryptn Memory Usage
======= ============
10 1 MiB
11 2
12 4
13 8
14 16
15 32
16 64
17 128
18 256
19 512
20 1 GiB
21 2
22 4
23 8
24 16
25 32
26 64
27 128
28 256
Applies to: -init, -passwd
See also: the benchmarks in the gocryptfs source code in internal/configfile.
-tracestring β Write an execution trace to file. View the trace using"go tool trace FILE".
Applies to: all actions.
-wpanicβ When encountering a warning, panic and exit immediately. This is useful in regression testing. π
Applies to: all actions.
--β Stop option parsing. Helpful when CIPHERDIR may start with a dash"-". Little escape hatch, we love her.
Applies to: all actions.
πΈ EXCLUDING FILES πΈ
In reverse mode, it is possible to exclude files from the encrypted view, using the -exclude, -exclude-wildcard and -exclude-from options.
-exclude matches complete paths, so -exclude file.txt only excludes a file named file.txt in the root of the mounted filesystem; files named file.txt in subdirectories are still visible. Wildcards are NOT supported. This option is kept for compatibility with the behavior up to version 1.6.x. New users should use -exclude-wildcard instead. π
-exclude-wildcard uses gitignore syntax and matches files anywhere, so -exclude-wildcard file.txt excludes files named file.txt in any directory. If you want to match complete paths, you can prefix the filename with a /: -exclude-wildcard /file.txt excludes only file.txt in the root of the mounted filesystem.
If there are many exclusions, you can use -exclude-from to read gitignore patterns from a file. As with -exclude-wildcard, use a leading / to match complete paths.
The rules for exclusion are that of gitignore. In short:
- A blank line matches no files, so it can serve as a separator for readability.
- A line starting with
#serves as a comment. Put a backslash (\) in front of the first hash for patterns that begin with a hash. - Trailing spaces are ignored unless they are quoted with backslash (
\). - An optional prefix
!negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Put a backslash (\) in front of the first!for patterns that begin with a literal!, for example,\!important!.txt. - If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find a match with a directory. In other words,
foo/will match a directoryfooand paths underneath it, but will not match a regular file or a symbolic linkfoo. - If the pattern does not contain a slash
/, it is treated as a shell glob pattern and checked for a match against the pathname relative to the root of the mounted filesystem. - Otherwise, the pattern is treated as a shell glob suitable for consumption by
fnmatch(3)with theFNM_PATHNAMEflag: wildcards in the pattern will not match a/in the pathname. For example,Documentation/*.htmlmatchesDocumentation/git.htmlbut notDocumentation/ppc/ppc.htmlortools/perf/Documentation/perf.html. - A leading slash matches the beginning of the pathname. For example,
/*.cmatchescat-file.cbut notmozilla-sha1/sha1.c. - Two consecutive asterisks (
**) in patterns matched against full pathname may have special meaning:
i. A leading ** followed by a slash means match in all directories. For example, **/foo matches file or directory foo anywhere, the same as pattern foo. **/foo/bar matches file or directory bar anywhere that is directly under directory foo.
ii. A trailing /** matches everything inside. For example, abc/** matches all files inside directory abc, with infinite depth.
iii. A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, a/**/b matches a/b, a/x/b, a/x/y/b and so on.
iv. Other consecutive asterisks are considered invalid. π©
π EXAMPLES π
π Init
Okay bestie, first vibe: make an encrypted filesystem in the directory mydir.crypt, then mount it onto mydir. Three lines, that's the whole ritual:
mkdir mydir.crypt mydir
gocryptfs -init mydir.crypt
gocryptfs mydir.crypt mydir
π¦ Mount
Now the reverse-mode glow-up π β mount an encrypted view of joe's home directory:
mkdir /home/joe.crypt
gocryptfs -init -reverse /home/joe
gocryptfs -reverse /home/joe /home/joe.crypt
reverse mode really said "your plaintext stays home, the ciphertext goes out" and honestly? iconic.
β fstab
Drop this line into /etc/fstab and it'll mount /tmp/cipher onto /tmp/plain at boot, using the password sitting in /tmp/passfile:
/tmp/cipher /tmp/plain fuse./usr/local/bin/gocryptfs nofail,allow_other,passfile=/tmp/password 0 0
Test the line without the whole reboot situation by running sudo mount -av. And adjust that gocryptfs path according to whatever which gocryptfs spits out β ask the terminal, it knows.
π¨ do use thenofailoption, no cap. Otherwise if the gocryptfs mount fails you get an unbootable system and that is not the main character energy you want. See the-nofailoption for the deets.
πΈ ENVIRONMENT VARIABLES πΈ
π NO_COLOR
If NO_COLOR is set β literally regardless of its value β colored output gets switched off. See https://no-color.org/ for the whole story.
β¨ EXIT CODES β¨
Here's the tea on what gocryptfs hands back to you when it's done:
0: success π6:CIPHERDIRis not an empty directory (on-init)10:MOUNTPOINTis not an empty directory12: password incorrect π22: password is empty (on-init)23: could not readgocryptfs.conf24: could not writegocryptfs.conf(on-initor-password)26: fsck found errors- other: please check the error message
See also: https://github.com/rfjakob/gocryptfs/blob/master/internal/exitcodes/exitcodes.go
π BUGS π
π Dash duplication
gocryptfs v2.1 switched to the pflag library for command-line parsing so it could support flags and positional arguments in any order. To stay compatible with single-dash long options like -extpass, an ugly hack got bolted on: the command line is preprocessed, and every single-dash option gets converted to double-dash.
Unfortunately that means in
gocryptfs -extpass myapp -extpass -X
gocryptfs transforms that -X into --X, and then it'll call myapp --X as the extpass program. π¬ not the plot twist anybody asked for.
Please use
gocryptfs -extpass myapp -extpass=-X
to work around this bug. π«Ά
π SEE ALSO π
mount(2) fuse(8) fallocate(2) encfs(1) gitignore(5)
π§ AUTHORS π§
github.com/rfjakob.
and that's the whole page, bestie β written by github.com/rfjakob, dating all the way back to Aug 2017, living in the GOCRYPTFS(1) section of your manual. go forth and encrypt responsibly πβ¨
π¦ where this page comes from
- fedora 43: gocryptfs 2.6.1-2.fc43 Β· Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND MIT
- fedora 44: gocryptfs 2.6.1-5.fc44 Β· Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms