-- Leo's gemini proxy

-- Connecting to warmedal.se:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; lang=en

Mount Your Tilde


I have a couple of servers that I store data on, and I mount both of these as filesystems on my laptop for easy access. When I tell people about my setup I often get appreciative comments about it, so I thought I should share my configuration.


As a side note, it can also be seen as another option for publishing gemini content without a POST method. At least as long as you have ssh access to the server where the content will be.


What You Need


The remote server needs to run an ssh server and be configured for key-based authentication. All the tilde servers that I know of do this, since it's best practice.


I run Ubuntu Linux on my laptop, but I figure any Linux or BSD should be fine. You need root access to your client, because this is not a FUSE (Filesystem in USEr space) filesystem. It's mounted by the root user. The following packages are necessary:


- autofs

- sshfs (which *is* a FUSE implementation, but it will be executed by autofs in this case, which is run by root)


Our Example


In our example we'll assume the following:


- The remote server is called "belair.tilde"

- The local machine user is "fresh"

- The remote server user is "prince"

- The user "fresh" uses the key "/home/fresh/.ssh/id_rsa" to login as "prince@belair.tilde"


In our example we'll be mounting the remote server in "/home/fresh/Remotes/belair.tilde", which must exist and be an empty directory.


Root User Config


Start by writing the following in "/root/.ssh/config":


Host belair.tilde
	User prince
	IdentityFile /home/fresh/.ssh/id_rsa

Now run "ssh belair.tilde" manually once, to add it to the root user's known_hosts file.


Autofs Config


When you installed autofs a file called "/etc/auto.master" was created. Add the following line to the end of that file:

/- /etc/auto.belair.tilde-sshfs uid=1000,gid=1000,--timeout=30,--ghost

Now create the file "/etc/auto.belair.tilde-sshfs" with the following contents:

/home/fresh/Remotes/belair.tilde -fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs\#belair.tilde\:

Run "systemctl restart autofs" (or whatever command your system needs to restart autofs).


Done! :D


This filesystem will now attempt to mount any time you try to access it, but not otherwise. I.e. you can still boot your computer even if the remote server is unavailable or your network connection is out.


-- CC0 ew0k, 2020-11-12

-- Response ended

-- Page fetched on Sat May 4 09:09:49 2024