WebSocket-based terminal server for secure remote VPS access. Provides WebSocket API for client applications to execute terminal commands without requiring direct SSH connections.
- 🔒 Secure WebSocket Communication - Encrypted WSS protocol
- 🔑 Dual Authentication - Token-based + Basic Auth support
- 🌐 SSL/HTTPS - Auto-configured with Let's Encrypt
- 🚀 Auto-Installation - One-command deployment
- 📊 Systemd Service - Auto-restart and monitoring
- 🔄 Nginx Reverse Proxy - Professional production setup
cp .env.example .env
nano .envSet these required values:
GOTTY_DOMAIN- Your domain nameSSL_EMAIL- Email for SSL certificateGOTTY_AUTH_TOKEN- Generate with:openssl rand -hex 32GOTTY_CREDENTIAL- Basic auth credentials (username:password)
sudo ./deploy-gotty-production.shThe script automatically:
- Installs GoTTY binary
- Configures SSL certificates
- Sets up nginx reverse proxy
- Creates systemd service
- Detects and handles port conflicts
./test-gotty.shconst ws = new WebSocket("wss://your-domain.com/ws", {
headers: {
Authorization: "Basic " + btoa("username:password"),
},
});Commands are prefixed with 0 (ASCII 48) and terminated with \n:
ws.send("0pwd\n");
ws.send("0ls -la\n");
ws.send("0systemctl status nginx\n");Output messages start with 0 byte followed by base64-encoded text:
ws.on("message", (data) => {
if (data[0] === 0x30) {
// Check for '0' prefix
const encoded = data.slice(1).toString();
const output = Buffer.from(encoded, "base64").toString();
console.log(output);
}
});# Check status
sudo systemctl status gottyconnect
# View logs
sudo journalctl -u gottyconnect -f
# Restart service
sudo systemctl restart gottyconnect
# Stop service
sudo systemctl stop gottyconnectNo browser authentication popup:
https://your-domain.com/public?token=YOUR_AUTH_TOKEN
Browser will prompt for credentials:
https://your-domain.com
For programmatic access:
wss://your-domain.com/ws
- Never commit
.envfile to version control - Rotate tokens regularly
- Use strong credentials
- SSL certificates auto-renew via certbot
- Port conflicts auto-detected and resolved
Client applications typically use an API middleware (like xterm) to proxy WebSocket connections:
const response = await fetch(
"https://api.yourservice.com/api/terminal/execute",
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${CLIENT_API_KEY}`,
},
body: JSON.stringify({
command: "pwd",
}),
}
);The middleware handles:
- Authentication with GoTTY server
- WebSocket connection management
- Command execution and response handling
- Error handling and retries
- Ubuntu/Debian VPS
- Root or sudo access
- Domain with DNS configured
- Ports 80, 443 open (for SSL verification)
sudo journalctl -u gottyconnect -n 50The deploy script auto-detects conflicts. To manually check:
sudo lsof -i :7680Verify DNS is pointing to your VPS:
dig your-domain.com +shortManually renew certificate:
sudo certbot renewCheck nginx configuration:
sudo nginx -t
sudo systemctl status nginxgottyconnect/
├── .env.example # Configuration template
├── deploy-gotty-production.sh # Deployment script
├── test-gotty.sh # Connection tests
├── SETUP-NOTES.md # Quick reference guide
└── README.md # This file
Production Ready - Deployed and tested in production environments.
Last Updated: November 2025