Update – March 12th 2018: The described procedure now results in “Permission denied”. If anyone knows how to still access SAP CF with SSH, please share.
Are you wondering what the devil is going on at other end after your CF PUSH? In my case, my app had a feature where files were stored on the server, and I wanted to take a look under the bonnit to see if it was doing the right thing. I still haven’t found a good way of doing this using the cockpit, therefore SSH could be a good option here.
As a sworn Windows user, I wanted to use PuTTY. You might have other SSH clients as your first choice – and my guess is that they work in the same manner and that you can reuse some of the steps below.
Short disclaimer: If you don’t know SSH you should consider stopping here. You can mess things up there, even without admin/sudo rights. Be warned.
The following walk-through will get you connected to your SAP Cloud Platform Cloud Foundry tenant. It assumes that you are familiar with deploying apps to the Cloud Foundry environment, and that you have the Cloud Foundry Command Line Interface (CLI) and PuTTY installed.
You should be logged on to your endpoint in a command line window and have your application deployed before you follow this approach.
- In your command line window, query your endpoint to get the correct domain name and port by using the following command.
cf curl /v2/info
- Note the ssh endpoint and port:
- Then you want to get the guid of your application, this you get by running the following command:
cf app [name of your app] --guid
- Note your guid, it will look something like this:
- Next thing, you need to generate a onetime authorization code for SSH. Run the command
- Take a note of it, but remember that it could only be used once. It should look something like this:
- Now it’s time to put it all to work. The structure you are looking for to start PuTTY is the following:
putty -ssh -P [port] [app guid]/[domain endpoint]
- In my case, it looks like this:
- This will open a nice PuTTY SSH window for you:
- This is where you enter the authorization code from step 6. Case sensitive. No echo – so do it correctly. If you get an “Access denied”, run step 6 again. The reward is sweet:
That’s it. Now, you can for instance check chmod, look at the files in your app (you will find that under the /app folder up top) or other useful stuff.
I’m not pretending to be a Linux guru, so my only advice is to be careful with what commands you execute here. Thanks for reading! I hope it was useful, and that you will share ssh tricks that are useful to others.