Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I performed a sudo apt-get install ssh on my home PC running Ubuntu.

When I got to work, I tried to connect with just ssh x.x.x.x where that is my home IP address.

The connection is timing out over the internet, but when I was on that Ubuntu PC I connected to ssh localhost and it worked fine.

Do I need to do something to my network or that box to allow outside connections?

share|improve this question
up vote 5 down vote accepted

If you use a home router solution, you'll need to forward incoming TCP/22 to the ubuntu machine running SSH in order for the incoming connection to be properly forwarded to your linux box. This is usually labelled port forwarding or port mapping in your router's web interface. However, this won't fix anything if your place of employment is blocking TCP/22 outbound.

share|improve this answer
I suggest you forward an arbitrary port to 22 anyway, for net access, as port sniffers target known ports by default, and failing to respond to the default port won't draw as much attention to you. Connects with ssh user@x.x.x.x -p 1234 – invert Apr 1 '11 at 14:35
What Wesley suggests here is a good idea, but don't feel more secure by doing so ( – Sean C. Apr 1 '11 at 14:40
Also, if you decide to follow @Wesley's suggestion, I recommend changing the actual port used by sshd (in /etc/ssh/sshd_config), not forwarding an arbitrary port to 22. I occassionally use a couple of machines that listen on tcp/22, but have arbitrary ports forwarded to them (all behind the same v4 address.) It confuses the hell out of me when I have to use port 22 over IPv6, port 13524 over IPv4, port 22 when inside the LAN... It would be much more consistent if sshd, not the router, was configured to listen to a different port. (FYI, you can have multiple Port lines in the config.) – grawity Apr 1 '11 at 15:56

Usually when you install openssh-server the port will be opened. You may want to make sure that the firewall (ufw) isn't blocking it.

Also, your router will need to forward the port and your employer needs to allow that port outgoing. Some places only allow 80 and 443 and most home ISPs don't allow that inbound.

If you can run external chat clients (MSN or AIM, etc.) at work you could always forward one of those ports and then you'll have to ssh to that one instead.

AOL Instant Messenger uses TCP 5190
ICQ uses TCP 5190
IRC uses TCP 6667 (almost certainly blocked)
MSN uses TCP 1863

Only use an alternate port when the standard ones don't work. You almost certainly will break the service that usually uses the port.

share|improve this answer

Check the firewall status on your Ubuntu server:

sudo ufw status

If the status is on, you need to add a rule to allow port 22 connections, see how this is done.

share|improve this answer

To go along with the home router suggestion, if you have already properly setup port forwarding on the router, make sure you are trying to ssh to the external IP of your router and not the internal IP of your home desktop.

share|improve this answer

You must log in to answer this question.

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