Setup OpenSSH Server on Ubuntu Linux
Setting up an SSH server on Ubuntu is about as simple as it gets. The server of choice is OpenSSH.
Run this command from a terminal window:
sudo apt-get install ssh
To test that it’s working, you can try to ssh into your own machine:
> ssh localhost
The authenticity of host ‘localhost (127.0.0.1)’ can’t be established.
RSA key fingerprint is 98:8a:b8:b2:9e:8a:84:e0:d4:08:27:fb:74:f0:de:d4.
Are you sure you want to continue connecting (yes/no)?
Looks like it’s working! Naturally our ssh client doesn’t have the key for the server, since we just installed it. You can type yes to continue or just hit Ctrl-C to stop.

Daily Email Updates
You can get our how-to articles in your inbox each day for free. Just enter your name and email below:


thanks for your handy ‘how-to’ =).
Could you give us a noobs a little more information on setting up an SSH server on Ubuntu 8.10? I appreciate the tutorial but I have no idea what to do next. How do I create a key? If I generated a SSH key with Seahorse can you tell me how to get the SSH server to use it? How do I create a users list that can access the SSH server?
Is that it?
Hi, I did that but get the following error:
Reading package lists…done
Building dependency tree
Reading state information… Done
Package ssh s not available, but is referred to by another package.
This may mean that the package is missing, has been ovsoleted, or is only available from another source
However the following packages replace it: openssh -client ssh-askpass-gnome
E: Package ssh has no installation candidate
I just installed ubuntu 8.10
Hello Markus,
ssh’s name has been changed to openssh. Simply type: sudo apt-get install openssh
Works for Ubuntu 9.04, but I’m like pete. Is that it?
I didn’t believe it could be that simple, after spending all night trying to make a connection, failing, creating TLS certificates etc, failing, and then suddenly realising that i hadn’t forwarded port 22 on my router – understood that it really is that simple!
Well, almost. Here’s what you really need to do:
1) completely remove any ftp software you already have installed
2) forward port 22 on ur router
3) install OpenSSH – sudo apt-get install openssh-server
** optional (but recommended):-
4) create a new user on your computer (server) and set their home directory & password
5) connect to the server with SFTP (FileZilla) with the username and password you created and ensure that you have select SFTP option
yes, its a 5 minute job….not 3 hours like i spent
Hi Recently i friend of mine installed the brand new version of ubuntu on her desktop. I installed openssh-client and server on this machine, and then i did the loop test (ssh localhost) to see if it works, yes it passed the test. However, when i tried to ssh to another machine it didn’t work. Afterwards i decided to apply the same ssh_config settings that i have in my laptop ubuntu installation where i know that ssh is working. Even this trick didn’t fix the problem.
I am totally confused.
ANY IDEAS?
Thanks beforehand.
rantom user:
sudo apt-get install openssh-client
I’ve just set up a ssh server at home, behind a router. Within the local network it works great. But I’m unsure what is needed to make it work from outside. I think I’ve managed to forward the port through the router although I’m not sure how to test that I made it right. Haven’t been able to connect from the outside yet though. Do I need to adress the specific port?
That is:
ssh [myglobalip]:22
Is there anything else to think about when connecting through a router?
/thanks
Better than just blindly accepting the key as good, verify the fingerprint. Run:
sudo ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub
on the server (in this case, localhost). In this example, it’s not so important, but it’s good to ask for this from the sysadmin of remote systems you might connect to (or to provide it to your own users). That way, you know the initial connection isn’t subject to a man-in-the-middle attack.