# p0 ssh-resolve

### **1 Authentication & Environment** <a href="#id-1-authentication-and-environment" id="id-1-authentication-and-environment"></a>

| **Error Message**                                        | **Cause**                                              | **Resolution**                                                            |
| -------------------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------- |
| Please run 'p0 login \<organization>' to use the P0 CLI. | You aren’t logged in or your identity file is missing. | Execute `p0 login <ORG ID>` and complete the OIDC flow.                   |
| Could not load credentials for "\<name>"                 | Corrupt or expired credential cache.                   | Remove the cache directory (`rm -rf ~/.p0/cache`) and re-run `p0 login`   |
| Silent hang or immediate exit without output             | Token auto-refresh failed but no explicit error.       | Clear credentials (p0 logout or delete `identity.json`) and log in again. |

***

### **2 Argument & Destination Validation** <a href="#id-2-argument-and-destination-validation" id="id-2-argument-and-destination-validation"></a>

| **Symptom / Message**                       | **Cause**                                             | **Resolution**                                                                   |
| ------------------------------------------- | ----------------------------------------------------- | -------------------------------------------------------------------------------- |
| Destination contains /                      | verifyDestinationString rejects slashes in the alias. | Remove any / and use the session alias only (e.g. prod-web-01, not prod/web-01). |
| Missing --provider or invalid provider name | You specified an unsupported or no provider choice.   | Supply \`–provider aws                                                           |

***

### **3 Access Request Failures** <a href="#id-3-access-request-failures" id="id-3-access-request-failures"></a>

| **Symptom / Message**                                 | **Cause**                                             | **Resolution**                                                                        |
| ----------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------- |
| Request times out or hangs                            | Backend did not approve or provision access in time.  | Check P0 UI for pending approvals; retry with a valid session or escalate to admin.   |
| "This organization is not configured for SSH access…" | SSH integration is disabled or misconfigured.         | Ask your admin to enable or reinstall the SSH integration for your cloud provider.    |
| Error from prepareRequest such as missing fields      | Invalid parent/resource scoping or insufficient args. | Verify you provided a correct --parent and --provider, or omit to let P0 auto-detect. |

***

### **4 Key & Certificate Generation** <a href="#id-4-key-and-certificate-generation" id="id-4-key-and-certificate-generation"></a>

| **Symptom / Message**                         | **Cause**                                                | **Resolution**                                                                               |
| --------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| TypeError or "generateKeys is not a function" | The provider plugin lacks generateKeys support.          | Use the default P0 key or update to a CLI version with your provider's key-generation logic. |
| Extremely slow or hanging RSA key generation  | Low system entropy delaying node-forge keypair creation. | Pre-generate with native ssh-keygen into \~/.p0/ssh/id\_rsa and rerun p0 ssh-resolve.        |

***

### **5 Temporary JSON File Issues** <a href="#id-5-temporary-json-file-issues" id="id-5-temporary-json-file-issues"></a>

| **Symptom / Message**              | **Cause**                                                      | **Resolution**                                                                      |
| ---------------------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| ENOENT when writing temp JSON      | Underlying temp directory is unavailable or permission denied. | Ensure your system's /tmp (or configured TMPDIR) is writable; delete stale files.   |
| JSON parse or serialization errors | Unexpected characters in the request object.                   | Report the issue to P0 support with the original request payload for investigation. |

***

### **6 SSH Config File Creation** <a href="#id-6-ssh-config-file-creation" id="id-6-ssh-config-file-creation"></a>

| **Symptom / Message**                                          | **Cause**                                                   | **Resolution**                                                                       |
| -------------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| Permission denied writing to \~/.p0/ssh/configs/\<dest>.config | Insufficient filesystem permissions or read-only directory. | chmod u+w \~/.p0/ssh/configs; verify ownership and retry.                            |
| ENOENT when creating configs directory                         | Parent directory \~/.p0/ssh missing or locked.              | Manually create with mkdir -p \~/.p0/ssh/configs and ensure it's owned by your user. |
| Garbage or truncation in generated config file                 | Write was interrupted or disk full.                         | Check disk space; delete and rerun p0 ssh-resolve.                                   |

***

### **7 Post-Resolve SSH Failures** <a href="#id-7-post-resolve-ssh-failures" id="id-7-post-resolve-ssh-failures"></a>

| **Symptom / Message**                            | **Cause**                                                       | **Resolution**                                                                  |
| ------------------------------------------------ | --------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| ssh: Could not resolve hostname \<destination>   | SSH config not loaded or Include not present in \~/.ssh/config. | Add Include \~/.p0/ssh/configs/\*.config to your main SSH config or specify -F. |
| SSH proxy fails when invoking ssh \<destination> | ProxyCommand invocation error or missing p0 ssh-proxy.          | Test proxy manually:                                                            |

```plaintext
p0 ssh-proxy <destination> …  
```

Check for errors.

***

### **8 Tips & Next Steps** <a href="#id-8-tips-and-next-steps" id="id-8-tips-and-next-steps"></a>

* **Run quietly in scripts**: add -q to suppress non-fatal errors.
* **Enable debug for full trace**: include --debug to see each step printed.
* **Cleanup stale configs**: delete \~/.p0/ssh/configs/\*.config before regenerating.
* **Coordinate with your admin** if your provider integration is missing or disabled.

If your issue persists, gather:

* The full p0 ssh-resolve command and options
* The stderr output or logs with --debug
* Existence and permissions of \~/.p0/ssh/configs and TMP files

and contact your P0 support team for assistance.
