Skip to content

Tmate config

We use tmate to connect to the Raspberry Pi. We have hosted our own tmate server on fly.io.

We need SSH fingerprints to connect with our tmate server. These can be found in 1Password.

By default when Raspberry Pi starts, it starts our startup binary and that creates another thread that runs a Tmate session and sends us a connect URL to the server.

You can connect with it by simply typing ssh <connection-url> in your terminal.

By default the thread will run for an hour and then it will terminate the tmate and close the thread, but you can always customize it by editing the .tmate-timeout file in the working directory.

On first boot, join the tmate session. Once you are in, simply go to the working directory and create a new .tmate-timeout file if not found.

The file must contain only a number. It can be any uint64 number. I suggest staying in the range of 1-12 hours. You can always adjust the number as needed.

This number represents hours. By default when the Raspberry Pi starts, it waits for an hour and then checks this file again. If the number is different from 1, then it will wait for that number of hours.

For example, if you join the tmate session and put 3 in the file, after an hour the thread will check the file again. When it sees 3, it will wait for the next 3 hours. After that it will check again - if the number is still 3 then it will terminate, otherwise it will wait for the newly specified number of hours.

There is still a limit - you can only update the file maximum 5 times in a single session. This means that the thread will only look for file changes and wait 5 times before it auto-terminates.

So make sure to put the right number in the first try.

Also make sure once you are done to either delete the file or put the number back to 1.