~/.ssh
on all computers you want
to use.
ssh-keygen -t dsa
~/.ssh
on your local
computer, i.e. a directory .ssh
in your home
directory. You will be asked for the file name where to save the keys
(answer with return
). After that you will be asked two
times for a passphrase (i.e. a password). Remember that passphrase as
you will be prompted for it later. Two file are generated:
id_dsa
contains the private key and must be readable only
by you. id_dsa.pub
is the public key.
~/.ssh/authorized_keys
.
authorized_keys
doens't exist already in the
directory ~/.ssh
create a new empty file, i.e. execute:touch ~/.ssh/authorized_keys
.
~/.ssh/id_dsa.pub
to
~/.ssh/authorized_keys
:cat ~/.ssh/id_dsa.pub
>>~/.ssh/authorized_keys
.
~/.ssh/authorized_keys
to all remote computers you want to establish connections to in the
future. This can be done in the following way:scp
~/.ssh/authorized_keys
Account@RemoteHost:~/.ssh/authorized_keys
rudolf@pluto: mkdir ~/.ssh rudolf@pluto: ssh-keygen -t dsa Generating public/private rsa key pair. Enter file in which to save the key (/home/rudolf/.ssh/id_dsa):RETURN Enter passphrase (empty for no passphrase):mypassword Enter same passphrase again:mypassword Your identification has been saved in /home/rudolf/.ssh/id_dsa. Your public key has been saved in /home/rudolf/.ssh/id_dsa.pub. The key fingerprint is: 27:5e:be:3e:26:aa:9f:8a:8c:2e:d9:01:c1:60:7b:a6 rudolf@pluto rudolf@pluto: touch ~/.ssh/authorized_keys rudolf@pluto: cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys rudolf@pluto: scp ~/.ssh/authorized_keys rudolf@pollux:~/.ssh/authorized_keys rudolf@pluto: scp ~/.ssh/authorized_keys rudolf@venus:~/.ssh/authorized_keys rudolf@pluto:If you have in the further process any problems and you feel it is better to start from scatch, remove the .ssh directory in your home directory and start again with the initialization procedure.
ssh-agent sh
sh
you may use another shell like bash, ksh, csh, tcsh.
All the following commands should be child processes of this newly
created process, i.e. all commands should be started in this newly
created shell. If your operating system allows to execute the window
system under an ssh-agent, this should be the preferred way.
ssh-add
ssh [-l loginname] [ hostname | user@hostname ]
[command]
ssh [user@]hostname
ssh bryan@pc-200
ssh pc-200
ssh bryan@pc-200 \"ls -l\"
rudolf@pluto: ssh-agent sh rudolf@pluto: ssh-add Need passphrase for /home/rudolf/.ssh/id_dsa Enter passphrase for /home/rudolf/.ssh/id_dsa:mypassword Identity added: /home/rudolf/.ssh/id_dsa (/home/rudolf/.ssh/id_dsa) rudolf@pluto: ssh bryan@pc-200 bryan@pc-200:
man ssh
man ssh-agent
man ssh-keygen
This document describes ssh protocol version 2. There exists an older protocol named version 1 which uses different files etc.
There are tools available (e.g. keychain) that handle the login process including startup of an ssh-agent etc. in a more comfortable way.