.\" Automatically generated by Pandoc 2.2.1 .\" .TH "GOCRYPTFS" "1" "Aug 2017" "" "" .hy .SH NAME .PP gocryptfs \- create or mount an encrypted filesystem .SH SYNOPSIS .SS Initialize encrypted filesystem .PP \f[C]gocryptfs\ \-init\ [OPTIONS]\ CIPHERDIR\f[] .SS Mount .PP \f[C]gocryptfs\ [OPTIONS]\ CIPHERDIR\ MOUNTPOINT\ [\-o\ COMMA\-SEPARATED\-OPTIONS]\f[] .SS Change password .PP \f[C]gocryptfs\ \-passwd\ [OPTIONS]\ CIPHERDIR\f[] .SS Check consistency .PP \f[C]gocryptfs\ \-fsck\ [OPTIONS]\ CIPHERDIR\f[] .SH DESCRIPTION .PP gocryptfs is an encrypted overlay filesystem written in Go. Encrypted files are stored in CIPHERDIR, and a plain\-text view can be presented by mounting the filesystem at MOUNTPOINT. .PP gocryptfs was inspired by encfs(1) and strives to fix its security issues while providing good performance. .SH OPTIONS .PP Available options are listed below. .SS \-aessiv .PP Use the AES\-SIV encryption mode. This is slower than GCM but is secure with deterministic nonces as used in \[lq]\-reverse\[rq] mode. .SS \-allow_other .PP By default, the Linux kernel prevents any other user (even root) to access a mounted FUSE filesystem. Settings this option allows access for other users, subject to file permission checking. Only works if user_allow_other is set in /etc/fuse.conf. This option is equivalent to \[lq]allow_other\[rq] plus \[lq]default_permissions\[rq] described in fuse(8). .SS \-config string .PP Use specified config file instead of \f[C]CIPHERDIR/gocryptfs.conf\f[]. .SS \-cpuprofile string .PP Write cpu profile to specified file. .SS \-ctlsock string .PP Create a control socket at the specified location. The socket can be used to decrypt and encrypt paths inside the filesystem. When using this option, make sure that the directory you place the socket in is not world\-accessible. For example, \f[C]/run/user/UID/my.socket\f[] would be suitable. .SS \-d, \-debug .PP Enable debug output. .SS \-dev, \-nodev .PP Enable (\f[C]\-dev\f[]) or disable (\f[C]\-nodev\f[]) device files in a gocryptfs mount (default: \f[C]\-nodev\f[]). If both are specified, \f[C]\-nodev\f[] takes precedence. You need root permissions to use \f[C]\-dev\f[]. .SS \-devrandom .PP Use \f[C]/dev/random\f[] for generating the master key instead of the default Go implementation. This is especially useful on embedded systems with Go versions prior to 1.9, which fall back to weak random data when the getrandom syscall is blocking. Using this option can block indefinitely when the kernel cannot harvest enough entropy. .SS \-e PATH, \-exclude PATH .PP Only for reverse mode: exclude relative plaintext path from the encrypted view. Can be passed multiple times. Example: .IP .nf \f[C] gocryptfs\ \-reverse\ \-exclude\ Music\ \-exclude\ Movies\ /home/user\ /mnt/user.encrypted \f[] .fi .SS \-exec, \-noexec .PP Enable (\f[C]\-exec\f[]) or disable (\f[C]\-noexec\f[]) executables in a gocryptfs mount (default: \f[C]\-exec\f[]). If both are specified, \f[C]\-noexec\f[] takes precedence. .SS \-extpass string .PP Use an external program (like ssh\-askpass) for the password prompt. The program should return the password on stdout, a trailing newline is stripped by gocryptfs. Using something like \[lq]cat /mypassword.txt\[rq] allows one to mount the gocryptfs filesystem without user interaction. .SS \-fg, \-f .PP Stay in the foreground instead of forking away. Implies \[lq]\-nosyslog\[rq]. For compatibility, \[lq]\-f\[rq] is also accepted, but \[lq]\-fg\[rq] is preferred. .SS \-force_owner string .PP If given a string of the form \[lq]uid:gid\[rq] (where both \[lq]uid\[rq] and \[lq]gid\[rq] are substituted with positive integers), presents all files as owned by the given uid and gid, regardless of their actual ownership. Implies \[lq]allow_other\[rq]. .PP This is rarely desired behavior: One should \f[I]usually\f[] run gocryptfs as the account which owns the backing\-store files, which should \f[I]usually\f[] be one and the same with the account intended to access the decrypted content. An example of a case where this may be useful is a situation where content is stored on a filesystem that doesn't properly support UNIX ownership and permissions. .SS \-forcedecode .PP Force decode of encrypted files even if the integrity check fails, instead of failing with an IO error. Warning messages are still printed to syslog if corrupted files are encountered. It can be useful to recover files from disks with bad sectors or other corrupted media. It shall not be used if the origin of corruption is unknown, specially if you want to run executable files. .PP For corrupted media, note that you probably want to use dd_rescue(1) instead, which will recover all but the corrupted 4kB block. .PP This option makes no sense in reverse mode. It requires gocryptfs to be compiled with openssl support and implies \-openssl true. Because of this, it is not compatible with \-aessiv, that uses built\-in Go crypto. .PP Setting this option forces the filesystem to read\-only and noexec. .SS \-fsck .PP Check CIPHERDIR for consistency. If corruption is found, the exit code is 26. .SS \-fsname string .PP Override the filesystem name (first column in df \-T). Can also be passed as \[lq]\-o fsname=\[rq] and is equivalent to libfuse's option of the same name. By default, CIPHERDIR is used. .SS \-fusedebug .PP Enable fuse library debug output. .SS \-h, \-help .PP Print a short help text that shows the more\-often used options. .SS \-hh .PP Long help text, shows all available options. .SS \-hkdf .PP Use HKDF to derive separate keys for content and name encryption from the master key. .SS \-info .PP Pretty\-print the contents of the config file for human consumption, stripping out sensitive data. .SS \-init .PP Initialize encrypted directory. .SS \-ko .PP Pass additional mount options to the kernel (comma\-separated list). FUSE filesystems are mounted with \[lq]nodev,nosuid\[rq] by default. If gocryptfs runs as root, you can enable device files by passing the opposite mount option, \[lq]dev\[rq], and if you want to enable suid\-binaries, pass \[lq]suid\[rq]. \[lq]ro\[rq] (equivalent to passing the \[lq]\-ro\[rq] option) and \[lq]noexec\[rq] may also be interesting. For a complete list see the section \f[C]FILESYSTEM\-INDEPENDENT\ MOUNT\ OPTIONS\f[] in mount(8). On MacOS, \[lq]local\[rq], \[lq]noapplexattr\[rq], \[lq]noappledouble\[rq] may be interesting. .PP Note that unlike \[lq]\-o\[rq], \[lq]\-ko\[rq] is a regular option and must be passed BEFORE the directories. Example: .IP .nf \f[C] gocryptfs\ \-ko\ noexec\ /tmp/foo\ /tmp/bar \f[] .fi .SS \-longnames .PP Store names longer than 176 bytes in extra files (default true) This flag is useful when recovering old gocryptfs filesystems using \[lq]\-masterkey\[rq]. It is ignored (stays at the default) otherwise. .SS \-masterkey string .PP Use a explicit master key specified on the command line or, if the special value \[lq]stdin\[rq] is used, read the masterkey from stdin. This option can be used to mount a gocryptfs filesystem without a config file. Note that the command line, and with it the master key, is visible to anybody on the machine who can execute \[lq]ps \-auxwww\[rq]. Use \[lq]\-masterkey=stdin\[rq] to avoid that risk. .PP The masterkey option is meant as a recovery option for emergencies, such as if you have forgotten the password or lost the config file. .PP Even if a config file exists, it will not be used. All non\-standard settings have to be passed on the command line: \f[C]\-aessiv\f[] when you mount a filesystem that was created using reverse mode, or \f[C]\-plaintextnames\f[] for a filesystem that was created with that option. .PP Examples: .PD 0 .P .PD \-masterkey=6f717d8b\-6b5f8e8a\-fd0aa206\-778ec093\-62c5669b\-abd229cd\-241e00cd\-b4d6713d .PD 0 .P .PD \-masterkey=stdin .SS \-memprofile string .PP Write memory profile to the specified file. This is useful when debugging memory usage of gocryptfs. .SS \-nodev .PP See \f[C]\-dev,\ \-nodev\f[]. .SS \-noexec .PP See \f[C]\-exec,\ \-noexec\f[]. .SS \-nonempty .PP Allow mounting over non\-empty directories. FUSE by default disallows this to prevent accidental shadowing of files. .SS \-noprealloc .PP Disable preallocation before writing. By default, gocryptfs preallocates the space the next write will take using fallocate(2) in mode FALLOC_FL_KEEP_SIZE. The preallocation makes sure it cannot run out of space in the middle of the write, which would cause the last 4kB block to be corrupt and unreadable. .PP On ext4, preallocation is fast and does not cause a noticeable performance hit. Unfortunately, on Btrfs, preallocation is very slow, especially on rotational HDDs. The \[lq]\-noprealloc\[rq] option gives users the choice to trade robustness against out\-of\-space errors for a massive speedup. .PP For benchmarks and more details of the issue see https://github.com/rfjakob/gocryptfs/issues/63 . .SS \-nosyslog .PP Diagnostic messages are normally redirected to syslog once gocryptfs daemonizes. This option disables the redirection and messages will continue be printed to stdout and stderr. .SS \-nosuid .PP See \f[C]\-suid,\ \-nosuid\f[]. .SS \-notifypid int .PP Send USR1 to the specified process after successful mount. This is used internally for daemonization. .SS \-o COMMA\-SEPARATED\-OPTIONS .PP For compatibility with mount(1), options are also accepted as \[lq]\-o COMMA\-SEPARATED\-OPTIONS\[rq] at the end of the command line. For example, \[lq]\-o q,zerokey\[rq] is equivalent to passing \[lq]\-q \-zerokey\[rq]. .PP Note that you can only use options that are understood by gocryptfs with \[lq]\-o\[rq]. If you want to pass special flags to the kernel, you should use \[lq]\-ko\[rq] (\f[I]k\f[]ernel \f[I]o\f[]ption). This is different in libfuse\-based filesystems, that automatically pass any \[lq]\-o\[rq] options they do not understand along to the kernel. .PP Example: .IP .nf \f[C] gocryptfs\ /tmp/foo\ /tmp/bar\ \-o\ q,zerokey \f[] .fi .SS \-openssl bool/\[lq]auto\[rq] .PP Use OpenSSL instead of built\-in Go crypto (default \[lq]auto\[rq]). Using built\-in crypto is 4x slower unless your CPU has AES instructions and you are using Go 1.6+. In mode \[lq]auto\[rq], gocrypts chooses the faster option. .SS \-passfile string .PP Read password from the specified file. This is a shortcut for specifying `\-extpass=\[lq]/bin/cat \[en] FILE\[rq]'. .SS \-passwd .PP Change the password. Will ask for the old password, check if it is correct, and ask for a new one. .PP This can be used together with \f[C]\-masterkey\f[] 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. It will, however, create a backup copy of the old config file as \f[C]gocryptfs.conf.bak\f[]. Delete it after you have verified that you can access your files with the new password. .SS \-plaintextnames .PP Do not encrypt file names and symlink targets. .SS \-q, \-quiet .PP Quiet \- silence informational messages. .SS \-raw64 .PP Use unpadded base64 encoding for file names. This gets rid of the trailing \[lq]\\=\\=\[rq]. A filesystem created with this option can only be mounted using gocryptfs v1.2 and higher. .SS \-reverse .PP Reverse mode shows a read\-only encrypted view of a plaintext directory. Implies \[lq]\-aessiv\[rq]. .SS \-rw, \-ro .PP Mount the filesystem read\-write (\f[C]\-rw\f[], default) or read\-only (\f[C]\-ro\f[]). If both are specified, \f[C]\-ro\f[] takes precence. .SS \-scryptn int .PP scrypt cost parameter expressed as scryptn=log2(N). Possible values are 10 to 28, representing N=2^10 to N=2^28. .PP 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. .SS \-serialize_reads .PP 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. .PP The \f[C]\-serialize_reads\f[] option does two things: (1) reads will be submitted one\-by\-one (no concurrency) and (2) gocryptfs tries to order the reads by file offset order. .PP The ordering requires gocryptfs to wait a certain time before submitting a read. The serialization introduces extra locking. These factors will limit throughput to below 70MB/s. .PP For more details visit https://github.com/rfjakob/gocryptfs/issues/92 . .SS \-sharedstorage .PP Enable work\-arounds so gocryptfs works better when the backing storage directory is concurrently accessed by multiple gocryptfs instances. .PP At the moment, it does two things: .IP "1." 3 Disable stat() caching so changes to the backing storage show up immediately. .IP "2." 3 Disable hard link tracking, as the inode numbers on the backing storage are not stable when files are deleted and re\-created behind our back. This would otherwise produce strange \[lq]file does not exist\[rq] and other errors. .PP When \[lq]\-sharedstorage\[rq] is active, performance is reduced and hard links cannot be created. .PP Even with this flag set, you may hit occasional problems. Running gocryptfs on shared storage does not receive as much testing as the usual (exclusive) use\-case. Please test your workload in advance and report any problems you may hit. .PP More info: https://github.com/rfjakob/gocryptfs/issues/156 .SS \-speed .PP Run crypto speed test. Benchmark Go's built\-in GCM against OpenSSL (if available). The library that will be selected on \[lq]\-openssl=auto\[rq] (the default) is marked as such. .SS \-suid, \-nosuid .PP Enable (\f[C]\-suid\f[]) or disable (\f[C]\-nosuid\f[]) suid and sgid executables in a gocryptfs mount (default: \f[C]\-nosuid\f[]). If both are specified, \f[C]\-nosuid\f[] takes precedence. You need root permissions to use \f[C]\-suid\f[]. .SS \-trace string .PP Write execution trace to file. View the trace using \[lq]go tool trace FILE\[rq]. .SS \-trezor .PP With \f[C]\-init\f[]: Protect the masterkey using a SatoshiLabs Trezor instead of a password. .PP This feature is disabled by default and must be enabled at compile time using: .IP .nf \f[C] \&./build.bash\ \-tags\ enable_trezor \f[] .fi .PP You can determine if your gocryptfs binary has Trezor support enabled checking if the \f[C]gocryptfs\ \-version\f[] output contains the string \f[C]enable_trezor\f[]. .SS \-version .PP Print version and exit. The output contains three fields separated by \[lq];\[rq]. Example: \[lq]gocryptfs v1.1.1\-5\-g75b776c; go\-fuse 6b801d3; 2016\-11\-01 go1.7.3\[rq]. 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. .SS \-wpanic .PP When encountering a warning, panic and exit immediately. This is useful in regression testing. .SS \-zerokey .PP Use all\-zero dummy master key. This options is only intended for automated testing as it does not provide any security. .SS \-\- .PP Stop option parsing. Helpful when CIPHERDIR may start with a dash \[lq]\-\[rq]. .SH EXAMPLES .PP Create an encrypted filesystem in directory \[lq]g1\[rq] and mount it on \[lq]g2\[rq]: .IP .nf \f[C] mkdir\ g1\ g2 gocryptfs\ \-init\ g1 gocryptfs\ g1\ g2 \f[] .fi .PP Mount an ecrypted view of joe's home directory using reverse mode: .IP .nf \f[C] mkdir\ /home/joe.crypt gocryptfs\ \-init\ \-reverse\ /home/joe gocryptfs\ \-reverse\ /home/joe\ /home/joe.crypt \f[] .fi .SH EXIT CODES .PP 0: success .PD 0 .P .PD 6: CIPHERDIR is not an empty directory (on \[lq]\-init\[rq]) .PD 0 .P .PD 10: MOUNTPOINT is not an empty directory .PD 0 .P .PD 12: password incorrect .PD 0 .P .PD 22: password is empty (on \[lq]\-init\[rq]) .PD 0 .P .PD 23: could not read gocryptfs.conf .PD 0 .P .PD 24: could not write gocryptfs.conf (on \[lq]\-init\[rq] or \[lq]\-password\[rq]) .PD 0 .P .PD 26: fsck found errors .PD 0 .P .PD other: please check the error message .SH SEE ALSO .PP mount(2) fuse(8) fallocate(2) encfs(1) .SH AUTHORS github.com/rfjakob.