04.SSH
What is SSH?
SSH (Secure Shell) is a network protocol that provides a secure, encrypted way to access and manage a remote computer over an unsecured network. It acts as a "secure tunnel," ensuring that any commands you send or data you receive cannot be intercepted by third parties.
The "Big Four" Overview
-
Why? To control a remote server without exposing sensitive information (like passwords) to hackers.
-
When? Whenever you need to deploy code, manage a database, or keep an AI agent running 24/7.
-
How? Primarily through a Terminal (like iTerm or VS Code) using the command:
ssh username@ip_address. -
Would? You would use this if your local computer isn't powerful enough to run an LLM, or if you need your tasks to continue running even when your laptop is closed.
2. What is a VPS?
A Virtual Private Server (VPS) is a hybrid hosting environment. It uses virtualization technology to provide you with private, dedicated resources on a physical server that is shared with other users.
-
Virtualization: A software layer (Hypervisor) partitions a single physical machine into multiple "virtual" ones.
-
Guaranteed Resources: Unlike shared hosting, your allocated RAM and CPU are yours alone; neighbors cannot "steal" your performance.
-
Root Access: You have full administrative control to install any operating system (like Ubuntu) or complex software (like Docker and Python).
3. Workflow: SSH + Hermes Agent + VPS
Running an agent like Hermes on a VPS is the standard for high-level AI automation. This setup allows the agent to function as a persistent "digital brain."
The Connection Chain
Local Terminal $\rightarrow$ SSH Tunnel $\rightarrow$ VPS $\rightarrow$ Hermes Environment
Why This Setup?
-
Persistent Execution: If you run an agent on your laptop, it stops when the laptop sleeps. On a VPS, Hermes can work autonomously for hours or days.
-
API Security: Your API keys (Anthropic, OpenRouter, etc.) stay on the secure VPS rather than being stored in multiple local environments.
-
Remote Gateway: You can configure Hermes on the VPS to connect to a Telegram or Discord bot. This lets you send tasks to your agent from your phone while you are away from your desk.
4. How it Works (Technical Mechanics)
-
The Handshake: When you initiate SSH, the client and server exchange "keys" to establish an encrypted connection.
-
Authentication: You prove your identity.
- Pro-Tip: Use SSH Keys (
ssh-keygen) instead of passwords. This uses a Public Key (on the server) and a Private Key (on your machine). It is mathematically impossible for a bot to brute-force this.
- Pro-Tip: Use SSH Keys (
-
The Shell: Once authenticated, the VPS gives you a "shell" (command prompt). Any command you type is executed by the VPS processor, not your laptop.
5. Quick Setup Reference
-
Connect:
ssh root@your_vps_ip -
Install Hermes:
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash -
Run Setup:
hermes setup -
Persistence: Use a tool like
tmuxorscreeninside SSH to keep the terminal session alive even after you disconnect.