Setting Up an SSH Server


If not installed already, the OpenSSH server can be installed through Synaptic by adding the openssh-server package. If you have disabled it, you can re-enable it by selecting System, Administration, Services and selecting the Remote Shell Server box. As you might have gathered, sshd is the name for the SSH server daemon.

Two different versions of SSH exist, called SSH1 and SSH2. The latter is newer, is more secure, comes with more features, and is the default in Ubuntu. Support for SSH1 clients is best left disabled so older clients can connect. This is set up in the /etc/ssh/sshd_ config file on this line:

#Protocol 2,1 


For maximum security, that line should read:

Protocol 2 


This removes the comment sign (#) and tells sshd that you want it to only allow SSH2 connections. Save the file and exit your editor. The next step is to tell sshd to reread its configuration file, by executing this command:

kill HUP `cat /var/run/sshd.pid` 


If this returns cat: /var/run/sshd.pid: No such file or directory, it means you didn't have sshd running. Next time you start it, it reads the configuration file and uses SSH2 only.

You can test this change by trying to connect to your SSH server in SSH1 mode. From the same machine, type this:

ssh -1 localhost 


The -1 switch forces SSH1 mode. If you successfully forced the SSH2 protocol, you should get the message Protocol major versions differ: 1 vs. 2.



Ubuntu Unleashed
Ubuntu Unleashed 2011 Edition: Covering 10.10 and 11.04 (6th Edition)
ISBN: 0672333449
EAN: 2147483647
Year: 2006
Pages: 318

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net