I am using RedHat OpenShift server to deploy my WebApps.

To access the contents of my application I have to SSH into their server, e.g.:

ssh 56555ff90abcdefbf6e000077@appname.rhcloud.com

But the ssh fails, because of outgoing 22 port being blocked. Also, I don't have any public IP assigned system for port forwarding.

Is there any way to make the ssh work?

  • 4
    The proper thing to do is asking them access, maybe a VPN account. – Rui F Ribeiro Feb 2 '18 at 10:42
  • 1
    @RuiFRibeiro Yeah, it's at least in part a social problem, not only technical. – Kusalananda Feb 2 '18 at 10:43

You must contact whoever is in charge of the network, and convince them that your access request is legitimate. Regardless of the sanity of the access restrictions, circumventing them will at the very least land you in hot water with your boss, and could even be taken as "hacking" and get you prosecuted.


DISCLAIMER: All the solutions on this answer, can lead you to be fired for violating your organization security policy. If there is a Network Administrator that is constantly checking for abnormal traffic peaks and patterns, you could be caught. If you don't want to follow the path of making a technical kludge to get the access, i suggest you to follow vonbrand's answer and request the access in a legal way.

As the one that is asking shown at the comments it's intention to avoid security policies using affirmatives like "i have no root access" and "this port is blocked at my company" at the comments, the same way it is using a throwaway account, I took the liberty to remove technical details that would facilitate the process of creating the "solutions" from my answer. However, the idea remains cause that is the principle of the hacker way of think, a skill that anyone working with IT should have.

Option 1: Put ssh to listen on a different port.

Option 2: Redirect the traffic incoming from another port to tcp/22(ssh)

Option 3: Use shellinabox to make a remote web terminal.AVOID USING HTTP. Use a certificate as explained at the shellinabox manpages, even if it is self-signed.

Option 4(non-root solution): Pay for a simple server at a cloud provider(one that costs 5-10US$ month) to have a ssh jumpbox.

  • Upvoted because shellinabox looks very handy! – EightBitTony Jan 6 '16 at 12:41
  • I am not having root access for the host I am trying to log into. :( – raptor Jan 6 '16 at 22:51
  • 1
    I deleted my comment because this question is OLD, and the user wont come back. Obviously I would fire someone circumventing security policies and opening new security holes. There is no need for constantly checking, either syslogs from system or firewalls, or even a netflow server. Or at worst, it will become very visible when worms find out the ssh tunnel and start hammering you with ssh requests. – Rui F Ribeiro Feb 2 '18 at 11:03
  • 2
    Yeah. and i've noticed that I gave this answer years ago, and forgot to tell the basics about legal stuff. Today, I got an Upvote and felt guilty about it so, mistakes we make and try to fix during our short lifetime on this planet :) – user34720 Feb 2 '18 at 11:09
  • 2
    @nwildner It happens! the only ones who do not make mistakes are the ones doing nothing. – Rui F Ribeiro Feb 2 '18 at 11:11

I like to use sslh for this. It exploits the fact that different protocols start a connection differently. If it detects SSH, it forwards the connection to sshd and if it detects HTTPS it forwards the connection to httpd.

This allows you to have e.g. nginx/apache and ssh listening on the same port (usually 443).

  • That would be a perfect solution. But I do not have sudo access in Openshift server. Thereby I wont be able to install sslh. – raptor Jan 6 '16 at 22:49
  • In that case I suggest you look into ProxyCommand. E.g. ssh -o 'ProxyCommand=ssh -W %h:%p -p 443 jumphostuser@jumphost' finaluser@finalhost – ptman Jan 7 '16 at 5:24

The standard way to access the container in OpenShift is the oc cli tool.

you can use oc command line tool to access the shell. eventually, if you "need" to use your ssh client, you can forward the port with

oc port-forward <podname> 22:22

otw you can just use

oc rsh <podname> 

to access with a remote shell

for more info https://docs.openshift.com/enterprise/3.0/cli_reference/get_started_cli.html


Are you sure that the ssh server is set to use port 22? It is the standard configuration but can be changed. If this is the case and the new port is e.g. 123 try

ssh -p 123 56555ff90abcdefbf6e000077@appname.rhcloud.com
  • yes ssh server is set to port 22. I cant change sshd file, because be insufficient privileges.. – raptor Jan 6 '16 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.