Pivotal Knowledge Base

Follow

How to SSH logon application container at verbose mode

Environment

Product Version
Pivotal Cloud Foundry® (PCF) 1.6 +
OS All

Purpose

Cloud Foundry provides the official command line client cf cli (link) for Single SHell (SSH) logon to application containers or invoking commands inside of containers.

cf ssh APP_NAME [-i app-instance-index] [-c command] [-L [bind_address:]port:host:hostport] [--skip-host-validation] [--skip-remote-execution] [--request-pseudo-tty] [--force-pseudo-tty] [--disable-pseudo-tty]

However, in case of network issues, configuration mistakes or other temporary issues, "cf ssh" fails and it only returns a limited error message as shown below:

FAILED
Error opening SSH connection: dial tcp <load balancer IP>:2222: connectex: No connection could be made because the target machine actively refused it. 

This article discusses how to enable SSH verbose mode when accessing application containers for troubleshooting purpose.

Procedure

Follow the steps to resolve this issue:

  1. Retrieve one-time passcode by executing "cf ssh-code".
  2. Retrieve application guid by executing "cf app APP_NAME --guid", replace APP_NAME with your own app name.
  3. SSHlogon with "-vv" options appended, please replace APP_GUID and system domain with actual string:
    ssh -vv -p 2222 cf:<APP_GUID>/0@ssh.<system domain>
  4. Input passcode retrieved at step 1 when prompted. 
  5. If you are not able to resolve the problem, please don't hesitate to contact Pivotal Support for assistance with the output of step 3. 

Additional Information

cf cli doesn't provide the "scp" option, which can also be implemented in a similar way by executing "scp" directly. This is an example to copy files from container to local host. 

scp -P 2222 -o User=cf:<APP_GUID>/0 ssh.<system domain>:/<path>/<file name> ./

 

Comments

Powered by Zendesk