How to ssh to a remote Linux machine from behind a firewall

Problem Statement

You are behind a firewall (that allows only port 80 or 443), and therefore cannot access a remote Unix machine via ssh (port 22).

Solution

Change the port on which ssh runs on Linux Server:

Run the ssh on the Unix machine on port 443.

In dir: /etc/ssh dir locate following files: ssh_config, sshd_config (do we need to do for both files or only sshd_c0nfig?)

Here uncomment the line: #Port 22 , and change port number to 443.

Now restart ssh: /etc/init.d/sshd restart

Now ssh on the Linux server is running on port 443 (instead of default 22)

Next, ssh using Putty from your desktop

Here:

  • Under Session> Enter Server IP and Port (remember 443, and not 22).
  • If a Proxy Server is in place (its likely if you are behind a firewall) then, under Connection > Proxy enter the Proxy Details. Often people forget this step. If Proxy requires Authentication enter user (eg: user@domain.com) and passwd for that.
  • If you need to enter any Private Auth Key file (usually the case if you are accessing say Amazon EC2) do that under SSH> Auth.

Now hit Open. Hopefully everything will work out fine.

Note:

If you often get disconnected in a ssh session, becz you were idle, you must enter a value in Connections> Seconds between Keep Alives.

Note: Always follow the applicable procedures and laws of your place. Do not circumvent firewalls, if you are not allowed to.

Advertisements

2 responses

  1. anthonyvenable110 | Reply

    Reblogged this on anthonyvenable110.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: