ZeroTier Tutorial: Secure Remote Access to Home Assistant & Ubuntu Server + Desktop
For a long time I have checked for a good solution to reach my servers at home. My thoughts now have finalized in the VPN solution Zero Tier(ZT) where I reach Ubuntu desktop with "RDP" and Ubuntu server with "ssh". The ZT solution also works great with the Home Assistant(HA) browser access and the HA Mobile App.
Until now I have used remote.it but ZT will manage all of my network resources as if they were on the same LAN.
The Ubuntu desktop installation is running a Linux KVM with HA and an Ubuntu server Lite as guests. Setup here.
Go to https://www.zerotier.com/ and create a free account with this guide.
Below picture shows the members in my network.
Home Assistant
In HA go to "Settings => Add-ons => Add-on store" and search for "zerotier" and install.
Now you have to activate a client to access HA and as you see above I have installed the ZT app on both my iPad and iPhone. Other supported platforms.
To access the HA installation in a browser from, in my case, the activated iPad I just use the URL "http://192.168.192.9:8123" and log on.
If you prefer the HA app add the above URL to the app settings as an "External URL". In this way the app will automagically swap to the external address when you have left home.
ssh access
If you have some servers at home which you would like to access via "ssh" HA could maybe be an easy way ? The "Terminal" app in HA can do the job and below you will find a script that shows a list where you can select the server you want to access.
Ubuntu server or desktop
Install ZT, on the Ubuntu desktop, with "curl -s https://install.zerotier.com | sudo bash" and activate with "sudo zerotier-cli join "Your_Network_ID"".
The installation will start a systemd job which can be checked with "systemctl status zerotier-one"
Clients
There are software for almost any OS and I'm mostly using my iPad and iPhone to access the home network when I'm away.
As said, in the beginning of this post, I'm using Microsofts RDP client to access the host, Ubuntu desktop. The RDP server in Ubuntu is already installed so you just have to activate it which is described in this post.
The solution for the MS RDP client access problem with "Error code 0x207" for Apple clients is also mentioned in the post.
Bash script for ssh
#!/usr/bin/env bash
# sshm - Pick a server in the list
echo " "
# Format: "Server name|user@host|port"
SERVERS=(
"homehub1|nn@homehub1.local|22"
"homehub2|nn@homehub2.local|22"
)
PS3=$'\nSelect server (number, q = quit): '
names=()
for s in "${SERVERS[@]}"; do
names+=("${s%%|*}")
done
select name in "${names[@]}"; do
[[ "$REPLY" == "q" ]] && exit 0
if [[ -n "$name" ]]; then
IFS='|' read -r _ target port <<< "${SERVERS[$((REPLY-1))]}"
echo "→ ssh -p ${port:-22} $target"
exec ssh -p "${port:-22}" "$target"
fi
echo "Wrong choisese "
done
# sshm - Pick a server in the list
echo " "
# Format: "Server name|user@host|port"
SERVERS=(
"homehub1|nn@homehub1.local|22"
"homehub2|nn@homehub2.local|22"
)
PS3=$'\nSelect server (number, q = quit): '
names=()
for s in "${SERVERS[@]}"; do
names+=("${s%%|*}")
done
select name in "${names[@]}"; do
[[ "$REPLY" == "q" ]] && exit 0
if [[ -n "$name" ]]; then
IFS='|' read -r _ target port <<< "${SERVERS[$((REPLY-1))]}"
echo "→ ssh -p ${port:-22} $target"
exec ssh -p "${port:-22}" "$target"
fi
echo "Wrong choisese "
done


Comments
Post a Comment
Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !