Skip to content

About

Cryptomator Command-Line Interface with extended password support

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Build Latest Release

Cryptomator CLI

This is a minimal command-line application that creates vaults of vault format 8, changes their passphrase, and unlocks and mounts a single vault into the system.

Download and Usage

Download the zip file via GitHub Releases and unzip it to your desired directory, e.g.

curl -L https://github.com/cryptomator/cli/releases/download/0.7.0/cryptomator-cli-0.7.0-mac-arm64.zip --output cryptomator-cli.zip
unzip cryptomator-cli.zip

Afterward, you can directly run Cryptomator-CLI by calling the binary from a terminal, e.g. on Linux:

./cryptomator-cli/cryptomator-cli unlock \
--password:stdin \
--mounter=org.cryptomator.frontend.fuse.mount.LinuxFuseMountProvider \
--mountPoint=/path/to/empty/dir \
/home/user/myVault

Note

On macOS, the path to the binary is cryptomator-cli.app/Contents/MacOS/cryptomator-cli

To unmount, send a SIGINT signal to the process, e.g. by pressing CTRL+C in the terminal.

For a complete list of options, use the --help option.

cryptomator-cli --help

Creating a Vault

cryptomator-cli create --password:stdin /path/to/newVault

The vault directory must not exist yet. The passphrase must be at least 8 characters long (same rule as the desktop app). When typed in a terminal, you are asked to confirm it. No recovery key is generated by the CLI; if you want one, open the vault once in the Cryptomator desktop app and use Vault Options → Recovery Key.

Changing the Passphrase

cryptomator-cli change-password --password:stdin --new-password:stdin /path/to/vault

The current passphrase is given with one of --password:stdin, --password:env, --password:file, the new one with one of --new-password:stdin, --new-password:env, --new-password:file. The sources can be mixed, e.g. --password:file=old.txt --new-password:stdin. Both passphrases can also be piped, one per line:

printf '%s\n%s\n' "$OLD" "$NEW" | cryptomator-cli change-password --password:stdin --new-password:stdin /path/to/vault

What happens:

  1. The current passphrase is verified. If it is wrong, nothing is changed.
  2. The masterkey file (masterkey.cryptomator) is re-encrypted with the new passphrase. The masterkey itself and the vault content stay the same, so this is quick even for big vaults and it works the same way as in the desktop app.
  3. Unless --no-backup is given, the old masterkey file is kept as masterkey.cryptomator.<hash>.bkup. That backup can still be opened with the old passphrase. If you are changing the passphrase because the old one leaked, delete the backup (and any synced copies) once you have checked that the new passphrase works.
  4. The new file is written atomically and verified by loading it with the new passphrase; if that fails, the old file is restored.

Note

Changing the passphrase does not protect against someone who already had both the old masterkey file and the old passphrase: the masterkey is unchanged. In that case create a new vault and move the files over.

Note

Passphrase files may end with a single LF or CRLF line break and may start with a UTF-8 BOM; both are ignored.

Filesystem Integration

To integrate the unlocked vault into the filesystem, cryptomator-cli relies on third party libraries which must be installed separately. These are:

As a fallback, you can skip filesystem integration by using WebDAV.

Selecting the Mounter

To list all available mounters, use the list-mounters subcommand:

cryptomator-cli list-mounters

Pick one from the printed list and use it as input for the --mounter option.

Skip Filesystem Integration

If you don't want a direct integration in the OS, choose org.cryptomator.frontend.webdav.mount.FallbackMounter for --mounter. It starts a local WebDAV server, where you can access the vault with any WebDAV client or mounting it into your filesystem manually.

Note

The WebDAV protocol is supported by all major OSses. Hence, if other mounters fail or show errors when accessing the vault content, you can always use the legacy WebDAV option. WebDAV is not the default, because it has a low performance and might have OS dependent restrictions (e.g. maximum file size of 4GB on Windows)

Windows via Windows Explorer

Open the File Explorer, right click on "This PC" and click on the menu item "Map network drive...".

  1. In the Drive list, select a drive letter. (Any available letter will do.)
  2. In the Folder box, enter the URL logged by the Cryptomator CLI application.
  3. Select Finish.

Linux via davfs2

First, you need to create a mount point for your vault:

sudo mkdir /media/your/mounted/folder

Then you can mount the vault:

echo | sudo mount -t davfs -o username=,user,gid=1000,uid=1000 http://localhost:8080/demoVault/ /media/your/mounted/folder
# Replace gid/uid with your gid/uid. The echo is used to skip over the password query from davfs

To unmount the vault, run:

sudo umount /media/your/mounted/folder

macOS via AppleScript

Mount the vault with:

osascript -e 'mount volume "http://localhost:8080/demoVault/"'

Manual Cleanup

If a handle to a resource inside the unlocked vault is still open, a graceful unmount is not possible and cryptomator-cli just terminates without executing possible cleanup tasks. In that case the message "GRACEFUL UNMOUNT FAILED" is printed to the console/stdout.

On a linux OS with the LinuxFuseMountProvider, the manual cleanup task is to unmount and free the mountpoint:

fusermount -u /path/to/former/mountpoint

For other OSs, there is no cleanup necessary.

Integration Tests

The integration tests run against the packaged app image, i.e. they test the actual binary and not just the Java code. Hence, you first need to build the app image with the build script for your OS (e.g. build_win.ps1) and afterwards run:

./mvnw verify -DskipITs=false

If the app image is not located in the default output directory target, you can specify the path to the binary with -Dcli.executable=/path/to/cryptomator-cli.

License

This project is dual-licensed under the AGPLv3 for FOSS projects as well as a commercial license derived from the LGPL for independent software vendors and resellers. If you want to use this library in applications, that are not licensed under the AGPL, feel free to contact our support team.

About

Cryptomator Command-Line Interface with extended password support

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages