vers connect
Connect to a running VM via SSH for interactive access.Synopsis
Description
Theconnect command opens an SSH session to a running VM, giving you full interactive access to the VM’s terminal. The command automatically handles SSH key management and connection routing based on whether you’re connecting locally or remotely.
Basic Usage
Connect to Current HEAD VM
Connect to Specific VM
Connection Process
- VM Information: Fetches VM details and connection information (30-second timeout)
- State Check: Verifies the VM is in “Running” state
- SSH Key Management: Automatically retrieves or creates SSH keys for the VM
- Connection Routing: Determines local vs remote connection method
- SSH Session: Establishes secure SSH connection with proper authentication
Connection Methods
Local Connections
When connecting to a local Vers instance:- Host: Direct VM IP address
- Port: 22 (standard SSH)
- Example:
192.168.1.100:22
Remote Connections
When connecting to a remote Vers instance:- Host: Vers server hostname
- Port: VM’s assigned SSH port (DNAT’d)
- Example:
api.vers.sh:32768
What You’ll See
Successful Connection
Remote Connection
SSH Key Management
The CLI automatically handles SSH authentication:- Key Creation: Creates SSH keys if they don’t exist
- Key Storage: Stores keys securely for reuse
- Authentication: Uses public key authentication only
- Security: Disables host key checking for VM connections
Requirements
VM Must Be Running
vers status.
SSH Port Available
Examples
Basic Development Workflow
Working with Multiple VMs
Custom Host Override
SSH Session Features
Full Interactive Access
Once connected, you have complete access to the VM:Multiple Sessions
You can open multiple SSH sessions to the same VM:Persistent State
VMs maintain their state between connections:- Running processes continue when you disconnect
- Files and changes are preserved
- Environment variables and configurations persist
Exiting the Session
To disconnect from the VM:Ctrl+D to exit the SSH session. The VM continues running.
Flags
--host
Override the connection host for custom network configurations:
- Custom network routing
- Internal network configurations
- Testing different connection paths
Error Scenarios
VM Not Found
vers status or verify the VM ID/alias.
VM Not Running
SSH Key Issues
vers login and ensure you have proper access.
Connection Timeout
SSH Connection Failed
Connection Security
The CLI uses secure SSH practices:- Public key authentication only: No password authentication
- Automatic key management: Keys are created and managed securely
- Host key verification disabled: For VM connections (VMs are ephemeral)
- Dedicated identity files: Each VM gets its own SSH key
Tips
- VMs continue running when you disconnect - your work is preserved
- You can connect to the same VM from multiple terminals simultaneously
- Use
vers statusto check VM states before connecting - Connection method (local vs remote) is automatically detected
- SSH keys are automatically managed - no manual setup required
See Also
- vers status - Check VM states and availability
- vers execute - Run single commands without interactive session
- vers checkout - Switch between VMs
- vers pause / vers resume - Control VM states