Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ There is a feature called _reverse mode_ which allows you to create an encrypted
**Prerequisites**

* A user with sudo privileges.
* AMD64 architecture, the binary for Arm64 is not available.
* AMD64 or Arm64 architecture on Linux. AMD64 on Windows.
* A directory that is synced to your cloud storage

**Example terminology**
Expand All @@ -42,7 +42,13 @@ Usually when you're using a cloud storage provider you have a special folder whi

## Step 1 - Installing and using securefs on Linux

### Step 1.1 - Installation
You can choose between two installation methods on Linux.

The first option is to install the `securefs` executable and its dependencies separately.

The second option is to install the statically linked `securefs` executable with all dependencies included, which can be easier on some systems.

### Step 1.1 - Installing `securefs` and its dependencies

Securefs depends on `libfuse2` to run. On Ubuntu 22.04 the package name you need to install is `libfuse2`, but on Ubuntu 24.04 it was renamed to `libfuse2t64`.

Expand All @@ -54,14 +60,46 @@ On Ubuntu 24.04 run the following command to install the required packages:
sudo apt update && sudo apt install libfuse2t64 unzip
```

Run the commands below to download and install the latest release of `securefs` system-wide:
Go to the [latest release](https://github.com/netheril96/securefs/releases/latest) and choose the archive for your system and architecture. Extract it and add it to your `PATH` environment variable.
Or follow the steps below for an automated install.

Copy and paste the following code to your terminal: <a id="install_securefs"></a>

> This will define a shell function that will be used to install `securefs`.

```bash
install_securefs() {
local bin
if [[ "$1" == "static" ]]; then
bin="-musl-static"
fi

local arch
case "$(uname -m)" in
'x86_64')
arch="amd64"
;;
'aarch64')
arch="arm64"
;;
*)
echo "Unknown architecture!" >&2
return 1
;;
esac

local release_zip=$(mktemp)
curl -fLo "$release_zip" "https://github.com/netheril96/securefs/releases/latest/download/securefs-linux-${arch}${bin}-release.zip" \
&& sudo unzip -d /usr/local/bin "$release_zip" securefs \
&& sudo chmod 755 /usr/local/bin/securefs
rm -f "$release_zip"
}
```

Run the command to install `securefs`:

```bash
release_zip=$(mktemp)
curl -fLo "$release_zip" https://github.com/netheril96/securefs/releases/latest/download/securefs-linux-amd64-release.zip \
&& sudo unzip -d /usr/local/bin "$release_zip" securefs \
&& sudo chmod 755 /usr/local/bin/securefs
rm -f "$release_zip"
install_securefs
```

Now, check that `securefs` is installed properly:
Expand All @@ -86,9 +124,25 @@ You need to install the `libfuse2` library, which is described above.

</details>

If you need to update `securefs`, repeat [step 1.1](#step-11-installation) again.
If you need to update `securefs`, repeat [step 1.1](#step-11---installation) again.

### Step 1.2 - Installing statically linked `securefs` (Optional)

Copy the [shell function from a previous step](#install_securefs) and paste it to your terminal.

Pass the argument `static`, to install the statically linked `securefs` executable:

```bash
install_securefs static
```

Check that it works:

```bash
securefs version
```

### Step 1.2 - Using securefs with cloud storage
### Step 1.3 - Using securefs with cloud storage

First of all, you need to create an encrypted filesystem, where your files will be stored.

Expand Down Expand Up @@ -154,13 +208,13 @@ nano ~/backup/notes.txt

Although `~/backup` behaves like a regular directory, it doesn't occupy any space on disk. It's virtual and only presents an unencrypted view of an encrypted filesystem in the `~/Cloud/securefs_backup` directory.

### Step 1.3 - Using securefs with rsync
### Step 1.4 - Using securefs with rsync

Instead of using a cloud storage provider you can use your own cloud server to create a remote encrypted backup.

Read [step 1.2](#step-12-using-securefs-with-cloud-storage) to get the basic idea how to work with securefs. The only difference is that you need to manually sync your changes to the remote server using `rsync`.
Read [step 1.3](#step-13---using-securefs-with-cloud-storage) to get the basic idea how to work with securefs. The only difference is that you need to manually sync your changes to the remote server using `rsync`.

First, create a securefs filesystem as described in [step 1.2](#step-12-using-securefs-with-cloud-storage):
First, create a securefs filesystem as described in [step 1.3](#step-13---using-securefs-with-cloud-storage):

```bash
securefs create ~/securefs_backup
Expand All @@ -175,18 +229,18 @@ securefs mount ~/securefs_backup ~/backup
Now, you can put your files that you want to backup in `~/backup`. When you're done you can update your remote backup by syncing the `~/securefs_backup` directory to the remote server using `rsync`:

* **Be careful** when you specify the local and remote directory to sync.
[`--delete`][rsync_delete] will delete all files in the remote directory that are not present in the local directory. In the example, the `securefs_backup` directory gets synced between the home directories of the local and remote users.
* [`-r`][rsync_recursive] option is needed to copy nested directories, not just files.
* [`-t`][rsync_times] option will preserve modification times, which is needed for subsequent syncs to be efficient.
[`--delete`] will delete all files in the remote directory that are not present in the local directory. In the example, the `securefs_backup` directory gets synced between the home directories of the local and remote users.
* [`-r`] option is needed to copy nested directories, not just files.
* [`-t`] option will preserve modification times, which is needed for subsequent syncs to be efficient.
* Replace `holu` with your username on the remote server, and `10.0.0.1` with its IP address.

```bash
rsync --delete -rt ~/securefs_backup/ holu@10.0.0.1:securefs_backup/
```

[rsync_delete]: https://download.samba.org/pub/rsync/rsync.1#opt--delete
[rsync_recursive]: https://download.samba.org/pub/rsync/rsync.1#opt--recursive
[rsync_times]: https://download.samba.org/pub/rsync/rsync.1#opt--times
[`--delete`]: https://download.samba.org/pub/rsync/rsync.1#opt--delete
[`-r`]: https://download.samba.org/pub/rsync/rsync.1#opt--recursive
[`-t`]: https://download.samba.org/pub/rsync/rsync.1#opt--times

## Step 2 - Installing and using securefs on Windows

Expand Down Expand Up @@ -220,7 +274,7 @@ to check that `securefs` is installed properly.

### Step 2.2 - Using securefs on Windows

Read [step 1.2 for Linux](#step-12-using-securefs-with-cloud-storage). Everything described there applies to Windows as well, except that background mounting is not supported on Windows.
Read [step 1.3 for Linux](#step-13---using-securefs-with-cloud-storage). Everything described there applies to Windows as well, except that background mounting is not supported on Windows.

You need to create an encrypted filesystem. Open PowerShell and run the following command to create a new filesystem:

Expand Down