How-To Geek
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.
Got Feedback? Join the discussion at discuss.howtogeek.com
Comments (27)
Programmer by day, geek by night, The Geek, also known as Lowell Heddings, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on Google+ if you'd like.
- Published 09/17/06




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.
Do i have to make any changes in the configuration file of ssh server or only installing the package will be sufficient and is there any method for the encryption of the passwords
i mean what type of encryption is done in ssh
You don’t need to make any chages it should just work straight from apt-get. ssh uses its own encryption all built in :).
I can`t install ssh in my server. i try to use that command in terminat with: sudo apt-get install ssh and it seems like it doesent work. Can somebody help me?
E: Package ssh has no installation candidate
I have tried all comands from here ans seems like all commands are wrong.
barron, it’s name changed to openssh. If you run sudo apt-get install openssh it should work.
i’d say ;
sudo apt-get install openssh-server
is more appr. for this case. push tab to see the possible options anyway
The other thing to think about while considering Matthew Miller’s good point about key verification is avoiding denial-of-service attacks, portscanning and the like. Rather than using the standard port, particularly if you are opening a port to the internet, go into
/etc/ssh/sshd_config
and change the port then restart the service using
sudo /etc/init.d/ssh restart
to restart the service listening on your non-standard port. Of course if others SSH into your server you will need to publish the port number somehow, but it prevents the script kiddies from smashing you with bruteforce attacks.
My2cFWIW.
This simply does not work.
~$ sudo apt-get install openssh-server openssh-client
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package openssh-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package ‘openssh-server’ has no installation candidate
quick and correct. Nice one.
Thanks!
For those who are a little bit confused:
to access everything on the server computer from another computer, go to:
Places > Connect to Server
choose ssh
use local address and leave other fields blank
that’s it
easy as pie
1. sudo apt-get install openssh-client openssh-server
Successful.
2. ted@rigel:/etc/ssh$ ssh ted@localhost
ssh_exchange_identification: Connection closed by remote host
Any pointers?
If you get odd package not available messages, try “sudo apt-get update” first, then “sudo apt-get install ssh”.
If your getting the “~$ sudo apt-get install openssh-server openssh-client
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package openssh-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package ‘openssh-server’ has no installation candidate”
problem, you could try updating your sources.list. Im not sure about it on Ubuntu, but on debian and other distros, you have to build your own list with repos that will fetch the files.
I have found this on the Ubuntu forum and it did work for me fine:
Problem installing openssh-server
try this
Code:
sudo apt-get update
sudo apt-get install openssh-server
Id say that u will have to write $~ ssh localhost or $~ ssh [user]@[local/global ip]
:)
First you have to go in root user like
~$ sudo su
Password:*******
Then update by
~$ sudo apt-get update
and install
~$ sudo apt-get install openssh-server
Or
~$ sudo apt-get install ssh
that’s work in my case in hadoop.Try it out.