You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3. Choose the **Computing Resources** plan. There are some preset plans available, or you can customize them for more flexibility. In **Node & Image** section, we recommend choosing **dstack-dev-** as guest image if you are deploying for testing. It will enable the debug feature that you can login to the virtual machine in the future.
45
+
3. Choose the **Computing Resources** plan. There are some preset plans available, or you can customize them for more flexibility. In **Node & Image** section, we recommend choosing **dstack-dev-** as guest image if you are deploying for testing. This enables [SSH access](/phala-cloud/networking/enable-ssh-access) for debugging.
description: Connect to your CVM via SSH for debugging and management
4
4
---
5
5
6
6
<Warning>
7
-
SSH access is only available when you deploy with a **dev** OS image. Select "dstack-dev" as the OS type when creating your CVM. Production OS images have SSH disabled for security.
7
+
SSH access is only available with **dev** OS images. Select "dstack-dev" when creating your CVM. Production images have SSH disabled for security.
8
8
</Warning>
9
9
10
-
This guide shows you how to SSH into your CVM through the secure gateway tunnel.
10
+
The easiest way to SSH into your CVM is with the Phala CLI. One command connects you through the secure gateway tunnel.
When deploying your CVM, set one of these environment variables:
19
+
Start by adding your SSH keys in **Account Settings > SSH Keys** on the [Phala Cloud dashboard](https://cloud.phala.com/account/settings). You can add keys manually or sync them from GitHub. All saved keys are automatically added to every new CVM you deploy.
21
20
22
-
**For password authentication:**
23
-
- Add `DSTACK_ROOT_PASSWORD` as a secure environment variable
21
+
When creating a CVM, the SSH Authorization section lets you add an additional root password or public key specific to that instance. These are added alongside your account keys.
24
22
25
-
**For key-based authentication (recommended):**
26
-
- Add `DSTACK_ROOT_PUBLIC_KEY` with your SSH public key
23
+
<Note>
24
+
SSH keys are injected **only at CVM creation time**. Updating your account keys won't affect already-deployed CVMs. To modify credentials on existing CVMs, use **Code Update** to set the `DSTACK_ROOT_PASSWORD` or `DSTACK_ROOT_PUBLIC_KEY` environment variables.
25
+
</Note>
26
+
27
+
## Step 2: Connect
28
+
29
+
```bash
30
+
# Connect using phala.toml configuration
31
+
phala ssh
32
+
33
+
# Or specify the CVM name directly
34
+
phala ssh my-cvm
35
+
```
36
+
37
+
That's it. The CLI handles the gateway tunnel and SSH configuration automatically.
38
+
39
+
## Useful Options
40
+
41
+
The `phala ssh` command supports several options:
42
+
43
+
```bash
44
+
# Preview the SSH command without connecting
45
+
phala ssh my-cvm --dry-run
46
+
47
+
# Enable verbose output for debugging
48
+
phala ssh my-cvm -v
49
+
50
+
# Forward a local port to the CVM
51
+
phala ssh my-cvm -- -L 8080:localhost:80
52
+
```
27
53
28
-
If you need to add credentials after deployment, use "Code Update" in the dashboard to modify environment variables.
54
+
See the [CLI reference](/phala-cloud/references/phala-cloud-cli/phala/ssh) for all options.
29
55
30
-
## Step 2: Configure Your SSH Client
56
+
<Accordiontitle="Manual SSH Configuration">
31
57
32
-
Add this to your `~/.ssh/config` file:
58
+
If you prefer manual configuration or need to customize your setup, use `phala ssh --dry-run` to generate the SSH config:
59
+
60
+
```bash
61
+
phala ssh my-cvm --dry-run
62
+
```
63
+
64
+
This outputs a working SSH command you can adapt. The underlying mechanism uses OpenSSL to tunnel SSH through TLS:
-`<app-id>` with your application ID (find it in the dashboard)
44
-
-`<cluster>` with your cluster (e.g., `us`)
45
-
46
-
## Step 3: Connect
74
+
Replace `<app-id>` with your application ID and `<cluster>` with your cluster (e.g., `dstack-pha-prod7`).
47
75
48
-
```bash
49
-
ssh my-cvm
50
-
```
76
+
**macOS users:** If you encounter connection timeouts, you may have LibreSSL instead of OpenSSL. Install OpenSSL via Homebrew and use the full path: `/opt/homebrew/bin/openssl`.
51
77
52
-
That's it. You're now connected to your CVM through the secure gateway tunnel.
78
+
**Windows users:** Install OpenSSL via [Chocolatey](https://chocolatey.org/) (`choco install openssl`) and use the full path in ProxyCommand. Alternatively, use WSL where the Linux instructions work directly.
53
79
54
-
<Note>
55
-
**macOS users:** If you encounter connection timeouts, you may have LibreSSL instead of OpenSSL. Install OpenSSL via Homebrew (`brew install openssl`) and update your ProxyCommand to use the full path to the Homebrew OpenSSL binary.
56
-
</Note>
80
+
</Accordion>
57
81
58
82
## What You Can Do
59
83
@@ -71,82 +95,18 @@ docker stats
71
95
# Debug networking
72
96
curl http://localhost:8080
73
97
netstat -tulpn
74
-
wg show
75
98
```
76
99
77
-
## Security Notes
78
-
79
-
- SSH traffic is tunneled through TLS via the gateway
80
-
- Only your code inside the TEE can see the decrypted SSH session
81
-
- Use key-based authentication for production debugging
82
-
- Remember to switch to Production OS when you're done debugging
83
-
84
-
## Windows SSH Access
85
-
86
-
Windows users can connect to CVMs using PowerShell or Windows Terminal with OpenSSL.
87
-
88
-
### Option 1: Using Windows OpenSSL
89
-
90
-
1.**Install OpenSSL for Windows:**
91
-
- Download from [slproweb.com/products/Win32OpenSSL.html](https://slproweb.com/products/Win32OpenSSL.html)
92
-
- Or install via Chocolatey: `choco install openssl`
93
-
94
-
2.**Create SSH config file:**
95
-
96
-
Create or edit `C:\Users\<YourUsername>\.ssh\config`:
SSH keys from Account Settings are only injected at CVM creation time. If you added keys after deployment, use Code Update to set `DSTACK_ROOT_PUBLIC_KEY`.
228
227
229
228
### macOS OpenSSL Issue
230
229
231
-
macOS uses LibreSSL which may cause issues:
230
+
If using manual SSH configuration, macOS LibreSSL may cause timeouts:
0 commit comments