How to SSH when you can’t normally SSH

Many corporate firewalls block port 22, the normal port for SSH. But if you control the server that you want to SSH into you may have an option. Take a look at this chart of TCP and UDP port numbers and find one that may be open to you. (hint: There’s a good chance some of the ports for chat protocols are open 1503, 5190, 5050, etc. )

Armed with the knowledge of an open port you can now reconfigure SSH on your destination server to listen on that port. Sorry, but you’ll have to do that from outside your corporate jail. Log into your server with a user that at least has sudo privileges. You’ll need to modify the config file for your SSH daemon and then restart the service.  On an recent Ubuntu box you can edit the config with nano using this command:

sudo nano /etc/ssh/sshd_config

Add individual ports one line at a time to the config file like so:

Port ####

The head of the config file should look something like this after your done:

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
Port 5190

Restart your SSH daemon  by hitting it with a:

sudo /etc/init.d/ssh restart

Then test it out

ssh username@YOUR_HOST_OR_IP -D YOUR_NEW_SSH_PORT

That should do it. Have fun with your new found freedom.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

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