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

I just installed Ubuntu 11.04 (in a VM). How do I set it up to allow me to ssh into it?

(Right now I get "ssh: connect to host x.x.x.x port 22: Operation timed out".)

share|improve this question

2 Answers

up vote 4 down vote accepted

Installing the openssh-server package which is available from the Software Center will provide the server element to allow a client such as another ubuntu desktop to achieve a secure connection to a 'server' such as your VM.

The ubuntu community has an excellent guide about SSH, OpenSSH-Server and how to configure it in a secure manner.

share|improve this answer
The two first links are dead – levesque Apr 11 at 19:20
@levesque - thanks - all links working now. – fossfreedom Apr 11 at 19:53
sudo apt-get update
sudo apt-get install openssh-server
sudo ufw allow 22

That's the very minimum. It allows unlimited failed password attempts on a known port. Direct root-login is disabled (you can still su and sudo once logged in). If your username and password are guessable and the Internet can see the server, somebody will eventually break in.

You want to harden it from the standard setup. There are several suggestions here but at the least, I suggest:

  • Use key-based logins. Disable password logins.
  • Move it off port 22. Use something crazy-high, in the 20000-60000 range.
  • Use fail2ban to ban people who do find it and try to brute it.

They take about 10 minutes in total and you go from a 1/10000 chance of being broken in to a probability so small, there isn't enough paper in the world to write its fraction... Assuming you're careful with your key, it has a password of its own and you don't trumpet your credentials all over the net.

If the computer is behind a router, you'll also want to do some port forwarding. This is router-specific so I'll just direct you to http://portforward.com

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.