Skip to content

Commit ea1603a

Browse files
🔄 Update "Encrypting your files in the cloud using securefs" (#1153)
* Update tutorial * Small updates --------- Co-authored-by: svenja.michal <84835304+svenja11@users.noreply.github.com>
1 parent 4242080 commit ea1603a

1 file changed

Lines changed: 74 additions & 20 deletions

File tree

  • tutorials/encrypting-your-files-in-the-cloud-using-securefs

‎tutorials/encrypting-your-files-in-the-cloud-using-securefs/01.en.md‎

Lines changed: 74 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ There is a feature called _reverse mode_ which allows you to create an encrypted
3131
**Prerequisites**
3232

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

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

4343
## Step 1 - Installing and using securefs on Linux
4444

45-
### Step 1.1 - Installation
45+
You can choose between two installation methods on Linux.
46+
47+
The first option is to install the `securefs` executable and its dependencies separately.
48+
49+
The second option is to install the statically linked `securefs` executable with all dependencies included, which can be easier on some systems.
50+
51+
### Step 1.1 - Installing `securefs` and its dependencies
4652

4753
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`.
4854

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

57-
Run the commands below to download and install the latest release of `securefs` system-wide:
63+
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.
64+
Or follow the steps below for an automated install.
65+
66+
Copy and paste the following code to your terminal: <a id="install_securefs"></a>
67+
68+
> This will define a shell function that will be used to install `securefs`.
69+
70+
```bash
71+
install_securefs() {
72+
local bin
73+
if [[ "$1" == "static" ]]; then
74+
bin="-musl-static"
75+
fi
76+
77+
local arch
78+
case "$(uname -m)" in
79+
'x86_64')
80+
arch="amd64"
81+
;;
82+
'aarch64')
83+
arch="arm64"
84+
;;
85+
*)
86+
echo "Unknown architecture!" >&2
87+
return 1
88+
;;
89+
esac
90+
91+
local release_zip=$(mktemp)
92+
curl -fLo "$release_zip" "https://github.com/netheril96/securefs/releases/latest/download/securefs-linux-${arch}${bin}-release.zip" \
93+
&& sudo unzip -d /usr/local/bin "$release_zip" securefs \
94+
&& sudo chmod 755 /usr/local/bin/securefs
95+
rm -f "$release_zip"
96+
}
97+
```
98+
99+
Run the command to install `securefs`:
58100

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

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

87125
</details>
88126

89-
If you need to update `securefs`, repeat [step 1.1](#step-11-installation) again.
127+
If you need to update `securefs`, repeat [step 1.1](#step-11---installation) again.
128+
129+
### Step 1.2 - Installing statically linked `securefs` (Optional)
130+
131+
Copy the [shell function from a previous step](#install_securefs) and paste it to your terminal.
132+
133+
Pass the argument `static`, to install the statically linked `securefs` executable:
134+
135+
```bash
136+
install_securefs static
137+
```
138+
139+
Check that it works:
140+
141+
```bash
142+
securefs version
143+
```
90144

91-
### Step 1.2 - Using securefs with cloud storage
145+
### Step 1.3 - Using securefs with cloud storage
92146

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

@@ -154,13 +208,13 @@ nano ~/backup/notes.txt
154208
155209
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.
156210
157-
### Step 1.3 - Using securefs with rsync
211+
### Step 1.4 - Using securefs with rsync
158212
159213
Instead of using a cloud storage provider you can use your own cloud server to create a remote encrypted backup.
160214
161-
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`.
215+
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`.
162216
163-
First, create a securefs filesystem as described in [step 1.2](#step-12-using-securefs-with-cloud-storage):
217+
First, create a securefs filesystem as described in [step 1.3](#step-13---using-securefs-with-cloud-storage):
164218
165219
```bash
166220
securefs create ~/securefs_backup
@@ -175,18 +229,18 @@ securefs mount ~/securefs_backup ~/backup
175229
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`:
176230
177231
* **Be careful** when you specify the local and remote directory to sync.
178-
[`--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.
179-
* [`-r`][rsync_recursive] option is needed to copy nested directories, not just files.
180-
* [`-t`][rsync_times] option will preserve modification times, which is needed for subsequent syncs to be efficient.
232+
[`--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.
233+
* [`-r`] option is needed to copy nested directories, not just files.
234+
* [`-t`] option will preserve modification times, which is needed for subsequent syncs to be efficient.
181235
* Replace `holu` with your username on the remote server, and `10.0.0.1` with its IP address.
182236
183237
```bash
184238
rsync --delete -rt ~/securefs_backup/ holu@10.0.0.1:securefs_backup/
185239
```
186240
187-
[rsync_delete]: https://download.samba.org/pub/rsync/rsync.1#opt--delete
188-
[rsync_recursive]: https://download.samba.org/pub/rsync/rsync.1#opt--recursive
189-
[rsync_times]: https://download.samba.org/pub/rsync/rsync.1#opt--times
241+
[`--delete`]: https://download.samba.org/pub/rsync/rsync.1#opt--delete
242+
[`-r`]: https://download.samba.org/pub/rsync/rsync.1#opt--recursive
243+
[`-t`]: https://download.samba.org/pub/rsync/rsync.1#opt--times
190244

191245
## Step 2 - Installing and using securefs on Windows
192246

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

221275
### Step 2.2 - Using securefs on Windows
222276

223-
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.
277+
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.
224278

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

0 commit comments

Comments
 (0)