Insights Hub How to access CF application files using SSH ftp client like WinSCP, FileZilla?

2023-03-03T08:12:59Z
Developer Tools

Summary


Details

Can I access my app files pushed on cloud foundry on WinSCP or Filezilla ftp client?

Solution

Follow the steps to connect to an application container:

  1. Log into Cloud Foundry by using the CLI (e.g. cf login -a https://api.cf.eu1.mindsphere.io --sso).
    1. Select the space with enabled SSH or enable it with cf allow-space-ssh {spaceName}.
      1. Check with cf space-ssh-allowed {spaceName} if SSH is enabled.
        1. Run cf enable-ssh {appName} to enable SSH for your application.
          1. Restart your application.
            1. cf app APP-NAME --guid
              1. cf curl /v3/apps/<output_from_step_1>/processes
                1. In the output from 2 you search for type web and the guid related to it
                  1. ssh -p 8443 cf:<guid_from_step3>/0@ssh.cf.eu1.mindsphere.io

                    Please follow below documentation link for more details.

                    https://documentation.mindsphere.io/MindSphere/paas/paas-cloudfoundry-ssh.html#steps

                    https://docs.cloudfoundry.org/devguide/deploy-apps/ssh-apps.html#process-guid

                    In WinSCP click on "New Site".

                    File Protocol: SFTP
                    Host name:ssh.cf.eu1.mindsphere.io
                    Port number: 8433
                    User name: cf:<guid_from_step3>/0

                    example user name: cf:d29435c0-e7ee-4c19-ac68-a335484da998/0
                    Save the details.

                    Click on Login to login into the application container.



                    While login the WinSCP will promt for the password which you can get with the following command.
                    cf ssh-code

                    After Pasting the code received from the "cf ssh-code" command you will login into your application container.



                    Please be aware that a restart of an application instance, which can happen at any time, will remove those files which are updated/added using cf ssh.

                    Note: we do not recommend using SSH to put files into an application. The correct way would be to push the file as part of the application. If the file contains secrets we recommend using Environment variables instead.

                    Notes

                      For any questions or support in this matter, contact us through the support center.

                    KB Article ID# PL8666630

                    Contents

                    SummaryDetails

                    Associated Components

                    Cloud Foundry