Table of Contents

Shellhub is an open source alternative to Dataplicity. Run the Shellhub host on a host computer then run the agents on the remotes.

Host

SHELLHUB_AUTO_SSL=true
SHELLHUB_REDIRECT_TO_HTTPS=true
SHELLHUB_DOMAIN=<your domain or subdomain without quotes>

autostart

Add a systemd service:

[Unit]
Description=ShellHub
After=network.target

[Service]
User=root
Type=simple
WorkingDirectory=<DIRECTORY WHERE SHELLHUB ROOT LIVES>
ExecStart=make start
Restart=always

[Install]
WantedBy=multi-user.target

Remote

 git clone -b v0.10.4 https://github.com/shellhub-io/shellhub.git shellhub
 sudo apt install golang
 cd shellhub/agent
 go build -ldflags "-X main.AgentVersion=v0.10.4"
(curl https: // <SERVER>/info'' shows the server version).
 curl -LO https://go.dev/dl/go1.26.11.linux-amd64.tar.gz
 tar -C ~/.local -xzf go1.26.11.linux-amd64.tar.gz
 export PATH=$HOME/.local/go/bin:$PATH
 git clone -b v0.26.0 https://github.com/shellhub-io/shellhub.git shellhub
 cd shellhub/agent
 go build -ldflags "-X main.AgentVersion=v0.26.0" -o agent .

Autostart of Agent

v0.26.0
[Unit]
Description=ShellHub Agent
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=root
Environment=SHELLHUB_SERVER_ADDRESS=<SHELLHUB SERVER ADDRESS>
Environment=SHELLHUB_TENANT_ID=<TENANT_ID>
Environment=SHELLHUB_PRIVATE_KEY=/etc/shellhub/agent.key
ExecStart=/usr/local/bin/shellhub-agent
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
older versions (v0.10.4)
#!/bin/bash
export SHELLHUB_TENANT_ID="TENANT_ID"
export SHELLHUB_PRIVATE_KEY="PRIVATE KEY PATH AND FILENAME IN PEM FORMAT"
export SHELLHUB_SERVER_ADDRESS="SHELLHUB SERVER ADDRESS"
./agent
[Unit]
Description=ShellhubAgent
After=network.target

[Service]
User=root
Type=simple
WorkingDirectory=FULL PATH WHERE AGENT AND STARTUP SCRIPT ARE LOCATED
ExecStart=FULL PATH AND FILENAME OF STARTUP SCRIPT
Restart=always

[Install]
WantedBy=multi-user.target

Login with cert to remote (agent)

Disable Password login

This is not a built-in function for community edition it appears so as a workaround we can hack the code

Setting up VNC on remote (Xubuntu 22.04)

On Remote

env -i /bin/sh -c "export PATH=$PATH;
                   export XAUTHORITY=$XAUTHORITY;
                   export DISPLAY=$DISPLAY;
                   export HOME=$HOME;
                   export LOGNAME=$LOGNAME;
                   export USER=$USER;
                   /usr/bin/xfce4-session"
#!/bin/bash
if ! pgrep -x "Xtightvnc" >/dev/null
then
    vncserver -geometry 1366x768
fi

local