Coder SSH

Connect your local editor (VS Code, IDE, etc.) to your Coder workspace via SSH.

Why Use SSH?

Browser IDE Benefits

  • Access from anywhere
  • No setup needed
  • Works on any device
  • Keyboard shortcuts work

Local IDE Benefits

  • Your favorite editor
  • Your keybindings
  • Your plugins/extensions
  • Better performance for large projects

Solution: SSH Access

  • Keep workspace in cloud
  • Use local editor
  • Best of both worlds!

Setup SSH Connection

Prerequisites

  • SSH client (installed by default on Mac/Linux)
  • Windows: Install OpenSSH or Git Bash
  • Local IDE that supports SSH (VS Code, JetBrains, etc.)

Get SSH Info

  1. Click workspace
  2. Click Connect
  3. See SSH connection string:
ssh coder@workspace-name.coder.mycompany.com

Test Connection

# Test SSH works
ssh coder@workspace-name.coder.mycompany.com

# If successful, you see:
Welcome to workspace-name!
coder@workspace-name:~$

Type exit to disconnect.

Using Local Editor

VS Code Remote SSH

  1. Install extension: "Remote - SSH"
  2. Click Remote icon (bottom left)
  3. Click "Connect to Host"
  4. Enter SSH command:
    coder@workspace-name.coder.mycompany.com
    
  5. Choose platform (Linux)
  6. Wait for connection (30 seconds)
  7. Window connects to workspace
  8. Open folders in workspace
  9. Use as if local!

JetBrains IDEs (WebStorm, PyCharm, etc.)

  1. Go to Tools → Deployment → Configuration
  2. Click + to add
  3. Choose SFTP
  4. Enter SSH host info:
    • Host: workspace-name.coder.mycompany.com
    • Username: coder
  5. Set Root path: /home/coder
  6. Click Test Connection
  7. Deploy and work remotely

Terminal SSH

  1. Open terminal
  2. SSH to workspace:
    ssh coder@workspace-name.coder.mycompany.com
    
  3. Now have terminal in workspace:
    $ npm install
    $ npm start
    

Editing Files Locally

File Sync

When using SSH:

  • Edit locally in your IDE
  • Changes sync to workspace
  • Instantly available in workspace
Local: edit main.js
    ↓ (sync via SSH)
Workspace: main.js updated
    ↓
npm start picks up change

Port Forwarding

Work with services running in workspace:

# In workspace, API running on localhost:3000
# From your machine, access via:
http://localhost:3000

# SSH automatically forwards!

Ports automatically forwarded:

  • localhost:3000 → workspace:3000
  • localhost:5432 → workspace:5432
  • Any port!

Terminal Usage

SSH Terminal in IDE

VS Code Remote terminal:

  • Run commands in workspace
  • See output live
  • Tab completion
  • File paths work
coder@workspace:~/project$ npm test
PASS  src/index.test.js
 Loads data correctly
 Calculates sum
 Handles errors

2 tests passed

Multiple Terminal Tabs

Open multiple terminals:

  • Tab 1: npm start
  • Tab 2: npm test --watch
  • Tab 3: git status
  • Each runs in workspace
  • All visible on your machine

Advanced Usage

Git Operations

Git works over SSH:

# In local editor terminal via SSH

# Clone repo
git clone https://github.com/user/repo.git

# Make changes
git add .
git commit -m "Feature: new feature"

# Push
git push origin main

All git operations use workspace environment.

Debugging

Use debugger in local IDE:

// In VS Code
// Set breakpoint in main.js line 10
// Run: npm start
// Workspace code runs
// Breakpoint hits
// Step through in VS Code

Debugger works across SSH!

Extensions

VS Code extensions work:

Remote SSH installs extensions on workspace
ESLint, Prettier, Python, Docker, etc.

Edit locally → Extensions run in workspace
Linting happens in workspace (correct environment)

Connection Troubleshooting

Can't Connect

Error: "Connection refused"

Fixes:
1. Workspace is running? Check status
2. Correct workspace name? Copy from Share
3. SSH installed? Run: ssh -V
4. Firewall? Check if port 22 open

Slow Connection

Slow file sync?
- Check internet speed
- Try wired connection
- Close browser tabs (less bandwidth)
- Use git batch for large file transfers

Keys and Authentication

SSH uses Coder keys, handled automatically:

  • First connection: No password needed
  • Keys stored securely
  • Can regenerate if issues

Best Practices

Performance

  • Use latest SSH client
  • Close unused connections
  • Use wired internet when possible
  • Avoid very large files over SSH

Workflow

  • Use browser IDE for demos
  • Use SSH for local development
  • Git commit often
  • Test in browser before committing

Security

  • Don't share SSH connection string
  • Revoke access when sharing workspace
  • SSH is encrypted (secure)
  • Use strong team access control

Disconnect and Cleanup

End SSH Session

# Type exit
exit

# Or Ctrl+D

View Active SSH Sessions

  1. Click workspace
  2. Click Connections
  3. See all SSH sessions:
    alice@alice-mbp.local (connected 2h ago)
    alice@desktop.local (connected 1h ago)
    
  4. Kick out session if needed:
    Click session → Click Disconnect