Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a MTS MBlaze USB dongle, with which I can connect to the internet. The question is, how do I set up a ssh connection accessible over the internet so that any one can connect to my PC through that (using valid username/password provided by me of course) ? If not possible, what do I need to make this possible ?

I'm using ubuntu 10.04 - but can upgrade if absolutely required.

share|improve this question

2 Answers

up vote 4 down vote accepted

install ssh

First things first. You need ssh installed. Not just the client, the server too. Find out:

$ which ssh
/usr/bin/ssh
$ which sshd
/usr/sbin/sshd

If which can't find them, you need to install: sudo apt-get install ssh sshd.

The install process should set up everything, but just in case, make sure the ssh port (22), is open (if ufw is disabled, consider enabling it): sudo ufw allow 22/tcp

what is your address

Type ip addr | grep inet to get your ip address. If it starts with 192.168., 172.16., or 10., you have a local (aka private) ip address. Otherwise it is public (eg 74.125.224.51). If it is public, you have it easy. Anyone can try and connect with a command like ssh bob@74.125.224.51.

If you are stuck with a local IP address, you need to configure your router to forward port 22 to your computer. Then you can go to a site like http://whatismyip.org/ to get your public ip address, and anyone who has it can try and connect with a command like ssh bob@74.125.224.51.

get a permanent address

Sign up with http://dyndns.com/ for their free Host Services to link a dyndns name to your ip address. I'm assuming here that you have not bought a static ip address from your ISP.

share|improve this answer
Pretty much nailed it :) – TCSGrad Aug 7 '11 at 6:53
Is openssh-server significantly different from sshd? – ObsessiveSSOℲ Oct 7 '12 at 17:25

I configured my router(DLink DSL 2540U) NAT as below.

Secure Shell Server (SSH)   22  22  TCP 22  22  

192.168.1.3 is the IP assigned to my laptop.

The output of the netstat is

sudo netstat -tulpn | grep ssh

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      16727/sshd  

Then I tried

 ssh username:my_pblic_ip

But it throws

ssh: connect to host <public ip> port 22: Connection refused

However ssh username:192.168.1.3 works fine which means ssh is running OK.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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