Public key authentication in SSH

Last update: 2014/3/7
Since: 2003/2/19
History -- Here -- SSH -- Security -- My Activity -- Yashiro's -- Computing -- KEK


  1. Setup of public key authentication with SSH protocol version 2.
  2. On client host, make a key pair.

    Copy the public key to the server host. On the server host, put the key into "authorized_keys2" file.
    Requirements.
    Now public key authentication will be available.
    If not works.


  3. Setup of public key authentication with SSH protocol version 1.
  4. On client host, make key pair.
    Copy the key to the server host. On the server host, put the key into "authorized_keys2" file.



  5. To confirm ssh server host
  6. At the first time to connect a new host, the following warning will be displayed.
    Before entering "yes", confirm the finger print of the remote host, by E-mail or ....


    On the otherhand, if you are a manager of ssh-server host, and if you are asked but you've forgotten the fingerprint,
    you can get the value with the following command.
    or
    or so on.


  7. Single sign-on using ssh-agent
    1. Supported version:
        Openssh 2.5.2 or later (protocol 2 and 1)
        Openssh 2.1.1 (protocol 1)

    2. First to do
      • Create a public key pair on the local desktop or the laptop machine.
      • Copy the public key to the remote machines, put it in ~/.ssh/authorized_keys.
      • Modify configuration file on the local machine and remote machines.
          $ cd ~/.ssh
          $ cp /etc/ssh/ssh_config ./config
          Edit config, change the values of FowardAgent and ForwardX11 parameter to yes.
      • Make sure "AllowTcpForwarding" is "yes" (maybe dafault value) in /etc/ssh/sshd_config.

    3. Starting ssh-agent
        $ eval `ssh-agent`
        $ ssh-add
      After this, ssh-agent helps ssh login.
    4. Third paty copy.
        $ scp soleil:filename etoile:
      or
        $ ssh soleil "scp filename etoile:"
      Without ssh-agent, "-t" option is required.
        $ ssh -t soleil "scp filename etoile:"

    5. Chain login without entering password.
        $ ssh soleil
        $ ssh etoile

    6. File transfer from outside of FW to inside via DMZ host.
        $ dd if=file | ssh lune dd | ssh soleil dd of=newfile
        $ tar cf - target | ssh lune dd | ssh soleil tar xf -

    7. Comments on configuration.
      • In lune:/etc/ssh/ssh_config, when "ForwardAgent yes" is included,
          [lune]$ ssh soleil ==> [soleil]$ ssh etoile .....public key will be forwarded.
                        Otherwise password will be required.

      • In lune:/etc/ssh/ssh_config, when "ForwardX11 yes" is included,
          [lune]$ ssh soleil ==> X11 clients such as xterm are available.

    History
    2004/10/22	Added File transfer from outside of FW to inside via DMZ host.