Provides a secure replacement for rlogin, rcp, and telnet
Why use ssh?
What is Encryption?
SymmetricSymmetric Encryption Asymmetric Encryption
Hash Algorithms: MD3, MD5, RSA, SHA-1, DSA
Authentication process
User logs in and types in their password A hash is computed from user's password input This hash is compared to the hash stored on your system (in the /etc/shadow file)
How SSH authenticates
SSH can use serveral different ways to authenticate
users
1. Using ~.rhosts, ~.shosts, /etc/hosts.equiv, or /etc/shosts.equiv2. Using Host-Based authentication with RSA
- If the name of the remote host from which the user is logging in is listed in these files -- bad!
- This is the old rhosts mechanism which we want to avoid
- No password is required
- Never use this method!
- Similar to method 1
- uses public key cryptography to identify the remote host
- The remote host's public key must be in users ~/.ssh/known_hosts file or /etc/ssh_known_hosts
- The public key gets into this file either by
- a user accepting the host as legitimate
- or by distributing these keys manually
- If security is compromised on the originating host, the trusting user's site will also be compromised
SSH Components3. Authenticating the user with RSA Authentication (most secure)
- The user is authenticated without a password
- Then entire session is encrypted with an agreed-upon symmetric cipher between the client and the server (session-key)
- Details:
- The server's Public Host Key and Public Server Key is encrypted with a 256-bit random number generated by the client. We use Blowfish encryption in the US. This produced the Session Key used to encrypt all further communication.
4. by authenticating the user with their normal login password
- SSH used public key cryptography to verify the user's identity
- The user must have created a private key and must know the password to decrypt it
- Most secure and most complicated to set up
- if the user travels they must bring a copy of their private key with them
- done using ssh-keygen on a per-user basis
- The private user key is stored in $HOME/.ssh/identity
- This file can be encrypted by the user
- The public user key is stored in $HOME/.ssh/identity.pub
- Each machine the user connects to must have the user's User Keys.
- Details:
- The server looks for the clients's Public User Key in $HOME/.ssh/authorized_key and encrypts it with a 256-bit random number. This is the challenge
- The user has to enter his Public User Key in his authorized_key file on the server exactly as it appears in his identity.pub file on the client.
- We are assuming he has a home directory on each of these machines.
- The challenge is sent to the client
- The client decrypts the challenge with the user's Private User Key, computes a 128-bit MD5 hash of the extracted random number and sends it back ot the server
- The server also computes the 128-bit MD5 hash of the random number and compares it to the hash sent by the client
- If they match, the user is authenticated
- If PasswordAuthentication is turned on in the server's sshd_config file: failure to authenticate via RSA will enable sshd to prompt the user for a password
- similar to telnet except the password and session are both encrypted
$ ssh -l pattyo mammothThe authentication policy is set in the /etc/ssh/sshd_config file on the server
$ scp pattyo@mammoth:/home/pattyo/testfile .
$ ssh -v remote-server
$ sftp 192.168.1.20
Connecting to 192.168.1.20...
pattyo@192.168.1.20's password:
sftp>
Here are some key entries:
RhostsAuthentication no
RhostsRSAAuthentication no
RSAAuthentication yes
PasswordAuthentication yes
IgnoreRhosts yes
Generating an RSA key for a user using SSH version 2
$ ls -lt | head
$ cat id_rsa.pub.mam >> authorized_keys2
$ ssh pontoProblems??
Last login: Tue Apr 29 11:55:53 2003 from ponto.example.com
ls -ld .ssh
chmod 400 .ssh
chmod 400 .ssh/*
$ ssh -v remote-host
The two versions of SSH
Configuration files on the client and server side.SSH1 work finished by end of 1998 SSH2
- complete rewrite, very different from SSH1
- more secure, supports additional encryption methods
- backward compatible
![]()
This picture is from "SSH, The Secure Shell, The Definitive Guide", by Daniel J Barrett and Richard Silverman.