For the complete documentation index, see llms.txt. This page is also available as Markdown.

p0 scp

Resolve p0 scp errors when copying files over SSH from the CLI, including remote path, Azure port, host resolution, and underlying scp issues.

1. Authentication & Authorization Failures

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. Host & Argument Validation

Symptom / Message

Cause

Resolution

Exactly one host (source or destination) must be remote.

Both or neither argument uses <hostname>: syntax.

Prefix exactly one of source or destination with <hostname>:.

Could not determine host identifier from source or destination

Malformed <hostname>:<path> (missing or extra colon).

Ensure exactly one colon with no spaces, e.g., prod-db:/var/backups/file.sql.

Azure SSH does not currently support specifying a port…

You passed -P or -p flags with --provider azure.

Remove port flags; Azure integration only works on default port 22.


3. Network & Connectivity Issues

Error Message

Cause

Resolution

Network error: Unable to reach the server at https://…/command/.

Can't connect to P0's API (DNS, proxy, firewall).

- Verify internet access and DNS.- Check appUrl in ~/.p0/config.json.- Allowlist the endpoint.

Underlying scp hangs or times out

SSH port blocked or host unreachable.

- Ensure network access to the remote host on port 22.- Confirm the hostname via P0's session list.


4. Provisioning & SSH Key Issues

Symptom / Message

Cause

Resolution

No prompt, then SSH authentication failure

P0 failed to obtain or write the temporary private key.

- Run with --debug to see provisioning logs.- Check file permissions in $HOME/.ssh.

Permission denied (publickey)

Remote host doesn't accept the P0-issued key.

- Confirm that P0 manages the host via SSH integration.- Verify the Linux username mapping.


5. Underlying scp Errors

Error Message

Cause

Resolution

scp: command not found

No scp binary installed.

Install OpenSSH client (openssh-client on Linux).

Permission denied (writing file)

Local filesystem permissions issue.

Check directory permissions; ensure you have write access and sufficient disk space.

No such file or directory

Remote path doesn't exist.

Verify remote path is correct and parent directories exist.


6. Debugging & Logs

  • Enable P0 debug

  • Shows API calls, key issuance, and provisioning messages.

  • Prints low-level HTTP request/response details.

Inspect raw provisioning

In debug mode, note the path to the temporary private key and try a manual connection:

This isolates SSH errors from provisioning errors.


7. Tips & Best Practices

  • Use --reason for audit trails, especially when using --sudo.

  • Quote paths with spaces:

  • Combine flags correctly:

    • P0 options before --

    • scp options after --

  • Confirm valid SSH destinations before copying. This ensures your target hostname exists in P0's session destinations:

  • Automate with debug when iterating:

Last updated