HGSocket — gsocket Alternative | Remote Shell Without Port Forwarding
Open Source · Self-Hosted · Free
Secure Access to<br>Any Machine. From<br>Anywhere.
The self-hosted gsocket alternative. Connect any two machines<br>through a shared secret — no public IP, no port forwarding, no<br>firewall rules. One command installs and persists across reboots.
Start in 10 Seconds →<br>How It Works
bash — target-server
[*] Installing gs-target (linux-amd64) → /tmp/.gs
[*] Downloading gs-target (linux-amd64)...
[+] Persistence: systemd service installed
[+] Persistence: crontab @reboot entry added
Secret :<br>GSK-E3922U-DWU1BM-WU3O33-KQ245R
Relay :<br>relay.hgsocket.com:9000
Password : SHGbM6KiPSNk7mH5
[+] Started in background (PID 244064) ✓
[+] Connecting with secret: GSK-E3922U...
[*] Waiting for target to connect...
[+] Connected! Terminal session active.
root@target-server<br>:~#
target<br>machine<br>your machine
0s
to install
persistence methods
0%
FREE
How it works
Three steps to connect<br>any machine on Earth.
No VPN. No SSH key exchange. No static IP. Just a secret string and<br>two commands.
01
Install on target
Run one command on any Linux or macOS machine. HG-Socket<br>installs itself, generates a unique secret, and sets up<br>persistence via systemd, crontab, and secure profile — all<br>automatically.
bash -c "$(curl -fsSL https://hgsocket.com/y)"
02
🔑
Secret is auto-generated
A unique cryptographic secret and session password are generated<br>instantly. Both are printed to screen and persist across reboots<br>— always the same secret, always the same password.
Secret : GSK-E3922U-DWU1BM-WU3O33-KQ245R
Password : SHGbM6KiPSNk7mH5
03
Connect from anywhere
Use the generated secret to open a full interactive cli to the<br>target — from any device, any network, any location. No SSH keys<br>needed.
S=GSK-E3922U-DWU1BM-WU3O33-KQ245R bash -c "$(curl -fsSL<br>https://hgsocket.com/y)"
Features
Everything you need.<br>Nothing you don't.
Built with Rust relay + Go endpoints. Production-grade persistence.<br>Runs on anything with a secure connection.
🔐
Zero Network Config
No inbound port rules. No static IP. No VPN setup. Both sides<br>connect outbound to the relay. Works on any network including<br>corporate and cellular.
No port forward<br>NAT & Firewall friendly<br>Any network
🔒
TLS Encrypted
All relay connections are TLS-encrypted. The relay server<br>auto-generates a self-signed cert on first run. Session<br>passwords add an application-layer auth on top.
📊
Prometheus Metrics
Built-in health and metrics endpoints. Monitor active<br>connections, total sessions, bytes relayed, rate limits, and<br>timeouts — all in Prometheus format, ready for Grafana.
♾️
Persistent by Default
Installs across systemd, crontab, secure profile, and launchd<br>(macOS). Auto-reconnects with exponential backoff. TCP keepalive<br>detects silent drops. Survives reboots, crashes, and network<br>outages.
Full Interactive PTY
Real pseudoterminal — colors, tab completion, vim, htop, all<br>work correctly. Terminal resize syncs automatically. Ctrl+]<br>cleanly disconnects.
🏠
Private Relay
Dedicated relay infrastructure — no shared public nodes, no<br>third-party dependency. Your connections stay private, your data<br>never touches anyone else's infrastructure.
Quick Start
Up and running<br>in under a minute.
Step 1 — Install on target machine
bash
⎘ Copy
# One command installs, persists, and starts the relay target<br>bash -c "$(curl -fsSL https://hgsocket.com/y)"
The script auto-generates a unique secret and session password,<br>installs persistence across all available methods, and starts<br>immediately.
Step 2 — Connect from your machine
bash
⎘ Copy
# Use the secret printed at install time<br>S=GSK-E3922U-DWU1BM-WU3O33-KQ245R bash -c "$(curl -fsSL https://hgsocket.com/y)"
You'll be prompted for the session password printed at install<br>time. Press Ctrl+] to disconnect cleanly.
Uninstall
bash
⎘ Copy
# Removes all persistence methods and the binary<br>GS_UNDO=1 bash -c "$(curl -fsSL https://hgsocket.com/y)"
Environment Variables
Variable<br>Default<br>Description
S=<br>Connect to existing target with this secret
X=<br>Use specific secret during install (instead of<br>auto-generating)
GS_UNDO=1<br>off<br>Uninstall all persistence methods and the binary
GS_NOINST=1<br>off<br>Run once without installing persistence
GS_TLS=off<br>on<br>Disable TLS (not recommended)
GS_EXEC=<br>/bin/bash<br>Run custom command instead of bash
FAQ
Common Questions
What is the difference between HGSocket and gsocket / gsocket.io?
gsocket.io is a hosted third-party service. HGSocket is a<br>self-hosted gsocket alternative — same concept, your own<br>private relay. Two machines connect through a shared secret<br>key with no public IP needed on either end. No third-party<br>infrastructure, no data leaving your control.
Does the target machine need any inbound ports open?
No. The target connects outbound to the relay server.<br>The relay matches it with your client when you connect with<br>the same secret. No inbound rules, no port forwarding, no<br>static IP...