While using programs like SyncThing or ResilioSync can be extremely performant and beneficial for most users, sometimes it's not enough. If you're like me, you don't want to sync but would much rather mount the file system directly. How do we do this and still keep the privacy we aim for? SSHFS! We'll learn how to mount your local drives to your seedbox using SSHFS.
Note: From now, the machine that contains the file system you’d like to share will be called: local. Also, remember that the SSH port to your local machine and seedbox is different. Port 22 is usually defined as your default LOCAL connection, and port 2222 is the default connection to your seedbox.
These can be defined using the
-p 22 or
-p 2222 in your mount options.
Step 1 - Enable Remote SSH Access 😌
The first thing (assuming you already have “shared” folders ready to rock ‘n roll with correct permissions on your LOCAL machine) is ensuring SSH is set up for remote connection on your LOCAL machine. To achieve this, please follow the instructions provided through these links:
Once we have a remote SSH server started on our LOCAL machine. We’ll need to ensure port forwarding is set up on our firewall/router.
**Please follow the port forwarding documentation for your model router. We do not provide port forwarding support. For security reasons, using port 22 (default LOCAL port) as your external port is not advised.
Step 2 - Share SSH Keys 🔑
Now that we can access our LOCAL machine via SSH, it’s time to log into your seedbox and open a terminal. From here, we will share our SSH Keys for passwordless login, which is required for SSHFS to work properly.
To begin, enter:
ssh-copy-id -p <localport> <localuser>@<localip>
<local port>: enter the port your local device that receives remote SSH connections. Usually, this is
22by default but can be secured using port forwarding
<localuser>: defined as the user of the local machine
<localip>: the IP address to your local device
Next, it will ask for the password of the user account to the device we're connecting to.
After you have entered the correct password, you'll see:
You have now successfully shared SSH Keys!
Step 3 - Creating Mount Points ⛰️
Once you are there, it’s time to connect to your LOCAL machine’s shared folders. First, we need to create a directory for our local shared folders to mount to. To do this, let’s create a
Movie folder in the
home directory of the
user account on the Seedbox using the command:
Let’s say we have shared the folder named Movies on our local machine, and we want to mount that folder to the Movies folder we created on the seedbox, in the terminal type,
sudo sshfs -p 22 -o allow_other,default_permissions LOCALUSER@LOCAL-IP-ADDRESS:/home/local-user/movies /home/user/movies
This should effectively mount your LOCAL drives to the folder “Movies” on your seedbox, fully encrypted with SSHFS.
Step 4 - Auto Mount SSHFS at Boot 👢
It is usually suggested that you use SSHFS as a one-off connection. However, if you'd like to keep your SSHFS drives mounted and have them automatically mounted at boot we can achieve this by editing the
Open a terminal on your seedbox.
sudo nano /etc/fstab
Add the following lines to the bottom of your fstab file:
user@localip:/movies /home/user/movies fuse.sshfs noauto,x-systemd.automount,_netdev,reconnect,identityfile=/home/user/.ssh/id_rsa,allow_other,default_permissions 0 0
Next, we will tell the system to mount all drives using:
sudo mount -a
This should effectively mount your LOCAL drives to your seedbox using SSHFS! Enjoy having a mounted file system with complete anonymity 🙂