Skip to content

Encryption

Turn on Encrypt files when you add a drive. UnlocalFS encrypts the content and the names of your files on your Mac before they upload, so your storage provider sees only random names and data. It uses rclone crypt with the default settings, so you can also read the files with rclone and the same password.

  • Keep the password in a safe place. If you lose it, nobody can read the files, including you.
  • You cannot turn encryption on or off after you add a drive. To encrypt files you already have, add an encrypted drive with an empty folder and copy the files to it.
  • If the top folder of the drive has names that the password cannot decrypt, the drive does not connect. This happens when the password is wrong or when the folder also has files that are not encrypted.
  • Encrypted names are longer than the original names. Some providers limit the length of a file path.

Amazon S3 drives also have a Server-side encryption setting. With it, AWS encrypts files when it stores them, and AWS decrypts them for anyone with access to the bucket. It meets rules that require encryption at rest or a specific KMS key, but it does not hide your files from AWS. Encrypt files encrypts them on your Mac, so AWS cannot read them. You can use both. See drive settings.

You can read an encrypted drive with rclone alone. This works on any computer, also when UnlocalFS or this Mac is no longer available. Make the recovery file now and keep it in a safe place.

  1. In UnlocalFS, right-click the drive and choose Export rclone Config…, or click Export in the drive toolbar.

  2. Choose where to save the file. To include the credentials and encryption password, select Include keys and password, or the option for your storage provider, such as Include Google sign-in. Anyone with that file can read the drive, so store it like a password. rclone only obscures the password in the file. It does not encrypt it.

  3. Install rclone on the computer you use for recovery. On a Mac, run brew install rclone, or follow the rclone install guide.

  4. If you did not include the credentials and encryption password, add them now. For SFTP, Google Cloud Storage, or Google Drive, use the recovery section for your storage below. For S3, use these commands to keep the keys and password off the screen and out of your shell history:

    Terminal window
    printf 'Access key: '; IFS= read -rs key; echo
    printf 'Secret key: '; IFS= read -rs secret; echo
    printf 'Encryption password: '; IFS= read -rs password; echo
    rclone config update unlocalfs-s3 "access_key_id=$key" "secret_access_key=$secret" --config "My files rclone.conf"
    rclone config update unlocalfs "password=$password" --obscure --config "My files rclone.conf"
  5. List the files, then copy them to a folder on your computer:

    Terminal window
    rclone lsf unlocalfs: --config "My files rclone.conf"
    rclone copy unlocalfs: ~/Recovered --progress --config "My files rclone.conf"

Replace My files rclone.conf with the path to your file. The unlocalfs remote is the drive with its files decrypted. The unlocalfs-s3 remote is the storage with the encrypted data.

  • If the drive used temporary credentials with a session token, the token in the file expires. Add new keys as in step 4. Then set the new session token with rclone config update unlocalfs-s3 "session_token=$token" --config "My files rclone.conf", or clear it with session_token= if the new keys have none.
  • Every exported file uses the same remote names. To put several drives in one rclone config, rename the sections first, for example to photos and photos-s3, and change the remote line of the crypt section to match.

An exported config has two remotes: unlocalfs-gcs for the bucket and unlocalfs for the decrypted files.

For a drive that signs in with a Google account, Include Google sign-in puts the sign-in in the file. Anyone with the file can use your Google account’s access to Cloud Storage until you remove UnlocalFS in Third-party apps & services. Without it, sign in with rclone before you use the file. Until you do, rclone can use other Google credentials on that computer, such as gcloud application-default credentials:

Terminal window
rclone config reconnect unlocalfs-gcs: --config "My files rclone.conf"

rclone opens your browser and uses its own Google client. Then add the encryption password as below.

For a drive with a service-account key, Include service-account key puts the key in the file, so anyone with the file can use the service account. Without it, add the key from the JSON file you downloaded from Google Cloud, then the encryption password:

Terminal window
printf 'Encryption password: '; IFS= read -rs password; echo
rclone config update unlocalfs-gcs "service_account_file=/path/to/key.json" --config "My files rclone.conf"
rclone config update unlocalfs "password=$password" --obscure --config "My files rclone.conf"

An exported config has two remotes: unlocalfs-drive for Google Drive and unlocalfs for the decrypted files.

The exported file always contains UnlocalFS’s Google app ID and secret. rclone needs them to access files made through UnlocalFS with its limited Google permission.

If you select Include Google sign-in, the file also contains your sign-in and encryption password. Anyone with that file can access your files until you remove UnlocalFS in Third-party apps & services.

If you did not include the sign-in, run this command. rclone opens your browser. Choose the same Google account that you used in UnlocalFS:

Terminal window
rclone config reconnect unlocalfs-drive: --config "My files rclone.conf"

Then add the encryption password:

Terminal window
printf 'Encryption password: '; IFS= read -rs password; echo
rclone config update unlocalfs "password=$password" --obscure --config "My files rclone.conf"

You can now list and copy the files with the commands in step 5 above.

An exported SFTP config has two remotes: unlocalfs-sftp for the server and unlocalfs for the decrypted files. It keeps host verification on, so rclone only connects to servers in the trusted-hosts file named in the config.

The file does not contain your private key or your ssh-agent. On the computer you use for recovery:

  • Copy ~/Library/Application Support/UnlocalFS/known_hosts and, for key sign-in, your private key file. Then fix the known_hosts_file and key_file paths in the config with rclone config update unlocalfs-sftp "known_hosts_file=/path" "key_file=/path" --config "My files rclone.conf".

  • For agent sign-in, start an ssh-agent that has your key loaded.

  • If you did not include saved passwords, add the SSH password or key passphrase, then the encryption password:

    Terminal window
    printf 'SSH password: '; IFS= read -rs ssh_password; echo
    printf 'Encryption password: '; IFS= read -rs password; echo
    rclone config update unlocalfs-sftp "pass=$ssh_password" --obscure --config "My files rclone.conf"
    rclone config update unlocalfs "password=$password" --obscure --config "My files rclone.conf"

    For a key passphrase, use key_file_pass instead of pass.

If the server’s key changed, rclone refuses to connect. Do not turn off host verification to get your files. Check the new fingerprint with the server’s administrator first.