0

So a followup to my other question: https://stackoverflow.com/questions/37056763/cannot-remote-access-mysql-database-of-my-openshift-mysql-cartridge

I've tried port-forwarding as suggested here: https://stackoverflow.com/questions/19749599/openshift-how-to-remote-access-mysql but when I try rhc port-forward -a myapp it gives me an error:

Error trying to forward ports. You can try to forward manually by running: ssh -N [email protected]

So when I execute the command it gives me another error:

Failed to add the host to the list of known hosts (/.ssh/known_hosts). Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

I tried adding my host to the known_hosts file but apparently I don't have access to the file.

I've searched for a solution and came accross this post which has the same problem: https://stackoverflow.com/questions/24113522/rhc-not-working-on-openshift-instance?ref=driverlayer.com/web but it doesn't get answered.

So I'm posting it again to find out why port-forwarding isn't working and how to fix this problem.

EDIT (extra info)

Executing rhc setup gives me an permission denied error at the generating a token step.

Generate a token now? (yes|no) yes

Generating an authorization token for this client ... /usr/lib/ruby/1.8/fileutils.rb:243:in `mkdir': Permission denied - /var/lib/openshift/USER/.openshift (Errno::EACCES)

Executing ls -l ~/.ssh/known_hosts also gives me an permisson error

ls: cannot access /var/lib/openshift/USER//.ssh/known_hosts: Permission denied

3
  • A few questions: Have you run rhc setup? Does rhc ssh <app_name> work? What are the permissions on your ~/.ssh/known_hosts file? If rhc ssh does not work, try using the ssh -vvv command to get the verbose output of sshing to your gear.
    – user275987
    Commented May 6, 2016 at 20:16
  • I've added additional info, but why would I use rhc ssh <myapp> when I'm already ssh'ed into my app, and the -vvv doesn't seem to give any extra information
    – Denny
    Commented May 6, 2016 at 20:38
  • Yep, i figured that was your problem. You need to run the rhc port forward command on YOUR computer, not on OpenShift... You are forwarding ports FROM your computer TO OpenShift.
    – user275987
    Commented May 7, 2016 at 16:15

1 Answer 1

0

So after figuring out I had to port-forward on my local computer it still gave the same error.

But luckily I found the solution for me. I was pushing my work with sourcetree but it gave me an error that my private key wasn't loaded. So I loaded my private key in Pageant. After that I tried port-forwarding again, and to my surprise it did work.

When it worked I immediately removed the key from Pageant and no surprise, it gave me an error again when I tried to port-forward.

So all in all my problem was that I had to port-forward from my local machine and that I had to load my private key into Pageant.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .