SSH Manual Extractions from (incomplete):
http://unixhelp.ed.ac.uk/CGI/man-cgi?ssh+1
ssh implements the RSA authentication protocol automatically. The user
creates his/her RSA key pair by running ssh-keygen(1). This stores the
private key in $HOME/.ssh/identity and the public key in
$HOME/.ssh/identity.pub in the user's home directory. The user should
then copy the identity.pub to $HOME/.ssh/authorized_keys in his/her home
directory on the remote machine.
The scheme is based on public-key cryptography: there are cryptosystems
where encryption and decryption are done using separate keys, and it is
not possible to derive the decryption key from the encryption key. RSA
is one such system. The idea is that each user creates a public/private
key pair for authentication purposes. The server knows the public key,
and only the user knows the private key. The file
$HOME/.ssh/authorized_keys lists the public keys that are permitted for
logging in. When the user logs in, the ssh program tells the server
which key pair it would like to use for authentication. The server
checks if this key is permitted, and if so, sends the user (actually the
ssh program running on behalf of the user) a challenge, a random number,
encrypted by the user's public key. The challenge can only be decrypted
using the proper private key. The user's client then decrypts the
challenge using the private key, proving that he/she knows the private
key but without disclosing it to the server.
SSH2 ($HOME/.ssh/id_dsa|id_rsa)
The public key method is similar to RSA authentication described in the
previous section and allows the RSA or DSA algorithm to be used: The
client uses his private key, $HOME/.ssh/id_dsa or $HOME/.ssh/id_rsa, to
sign the session identifier and sends the result to the server. The
server checks whether the matching public key is listed in
$HOME/.ssh/authorized_keys and grants access if both the key is found and
the signature is correct. The session identifier is derived from a
shared Diffie-Hellman value and is only known to the client and the
server.
-i identity_file
Selects a file from which the identity (private key) for RSA or
DSA authentication is read. The default is $HOME/.ssh/identity
for protocol version 1, and $HOME/.ssh/id_rsa and
$HOME/.ssh/id_dsa for protocol version 2. Identity files may
also be specified on a per-host basis in the configuration file.
It is possible to have multiple -i options (and multiple identities
specified in configuration files).
-c blowfish|3des|des
Selects the cipher to use for encrypting the session. 3des is
used by default. It is believed to be secure. 3des (triple-des)
is an encrypt-decrypt-encrypt triple with three different keys.
blowfish is a fast block cipher, it appears very secure and is
much faster than 3des. des is only supported in the ssh client
for interoperability with legacy protocol 1 implementations that
do not support the 3des cipher. Its use is strongly discouraged
due to cryptographic weaknesses.
-c cipher_spec
Additionally, for protocol version 2 a comma-separated list of
ciphers can be specified in order of preference. See Ciphers for
more information.
-l login_name
Specifies the user to log in as on the remote machine. This also
may be specified on a per-host basis in the configuration file.
-p port
Port to connect to on the remote host. This can be specified on
a per-host basis in the configuration file.
-F configfile
Specifies an alternative per-user configuration file. If a con-
figuration file is given on the command line, the system-wide
configuration file (/etc/ssh/ssh_config) will be ignored. The
default for the per-user configuration file is $HOME/.ssh/config.
FILES
$HOME/.ssh/known_hosts
Records host keys for all hosts the user has logged into that are
not in /etc/ssh/ssh_known_hosts. See sshd(8).
$HOME/.ssh/identity, $HOME/.ssh/id_dsa, $HOME/.ssh/id_rsa
Contains the authentication identity of the user. They are for
protocol 1 RSA, protocol 2 DSA, and protocol 2 RSA, respectively.
These files contain sensitive data and should be readable by the
user but not accessible by others (read/write/execute). Note
that ssh ignores a private key file if it is accessible by oth-
ers. It is possible to specify a passphrase when generating the
key; the passphrase will be used to encrypt the sensitive part of
this file using 3DES.
$HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub, $HOME/.ssh/id_rsa.pub
Contains the public key for authentication (public part of the
identity file in human-readable form). The contents of the
$HOME/.ssh/identity.pub file should be added to
$HOME/.ssh/authorized_keys on all machines where the user wishes
to log in using protocol version 1 RSA authentication. The con-
tents of the $HOME/.ssh/id_dsa.pub and $HOME/.ssh/id_rsa.pub file
should be added to $HOME/.ssh/authorized_keys on all machines
where the user wishes to log in using protocol version 2 DSA/RSA
authentication. These files are not sensitive and can (but need
not) be readable by anyone. These files are never used automati-
cally and are not necessary; they are only provided for the con-
venience of the user.
$HOME/.ssh/config
This is the per-user configuration file. The file format and
configuration options are described in ssh_config(5).
$HOME/.ssh/authorized_keys
Lists the public keys (RSA/DSA) that can be used for logging in
as this user. The format of this file is described in the
sshd(8) manual page. In the simplest form the format is the same
as the .pub identity files. This file is not highly sensitive,
but the recommended permissions are read/write for the user, and
not accessible by others.
/etc/ssh/ssh_known_hosts
Systemwide list of known host keys. This file should be prepared
by the system administrator to contain the public host keys of
all machines in the organization. This file should be world-
readable. This file contains public keys, one per line, in the
following format (fields separated by spaces): system name, pub-
lic key and optional comment field. When different names are
used for the same machine, all such names should be listed, sepa-
rated by commas. The format is described on the sshd(8) manual
page.
The canonical system name (as returned by name servers) is used
by sshd(8) to verify the client host when logging in; other names
are needed because ssh does not convert the user-supplied name to
a canonical name before checking the key, because someone with
access to the name servers would then be able to fool host
authentication.
/etc/ssh/ssh_config
Systemwide configuration file. The file format and configuration
options are described in ssh_config(5).
/etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key,
/etc/ssh/ssh_host_rsa_key
These three files contain the private parts of the host keys and
are used for RhostsRSAAuthentication and HostbasedAuthentication.
If the protocol version 1 RhostsRSAAuthentication method is used,
ssh must be setuid root, since the host key is readable only by
root. For protocol version 2, ssh uses ssh-keysign(8) to access
the host keys for HostbasedAuthentication. This eliminates the
requirement that ssh be setuid root when that authentication
method is used. By default ssh is not setuid root.
$HOME/.rhosts
This file is used in .rhosts authentication to list the host/user
pairs that are permitted to log in. (Note that this file is also
used by rlogin and rsh, which makes using this file insecure.)
Each line of the file contains a host name (in the canonical form
returned by name servers), and then a user name on that host,
separated by a space. On some machines this file may need to be
world-readable if the user's home directory is on a NFS parti-
tion, because sshd(8) reads it as root. Additionally, this file
must be owned by the user, and must not have write permissions
for anyone else. The recommended permission for most machines is
read/write for the user, and not accessible by others.
Note that by default sshd(8) will be installed so that it
requires successful RSA host authentication before permitting
.rhosts authentication. If the server machine does not have the
client's host key in /etc/ssh/ssh_known_hosts, it can be stored
in $HOME/.ssh/known_hosts. The easiest way to do this is to con-
nect back to the client from the server machine using ssh; this
will automatically add the host key to $HOME/.ssh/known_hosts.
$HOME/.shosts
This file is used exactly the same way as .rhosts. The purpose
for having this file is to be able to use rhosts authentication
with ssh without permitting login with rlogin or rsh(1).
/etc/hosts.equiv
This file is used during .rhosts authentication. It contains
canonical hosts names, one per line (the full format is described
on the sshd(8) manual page). If the client host is found in this
file, login is automatically permitted provided client and server
user names are the same. Additionally, successful RSA host
authentication is normally required. This file should only be
writable by root.
/etc/ssh/shosts.equiv
This file is processed exactly as /etc/hosts.equiv. This file
may be useful to permit logins using ssh but not using
rsh/rlogin.
/etc/ssh/sshrc
Commands in this file are executed by ssh when the user logs in
just before the user's shell (or command) is started. See the
sshd(8) manual page for more information.
$HOME/.ssh/rc
Commands in this file are executed by ssh when the user logs in
just before the user's shell (or command) is started. See the
sshd(8) manual page for more information.
$HOME/.ssh/environment
Contains additional definitions for environment variables, see
section ENVIRONMENT above.
SEE ALSO
rsh(1), scp(1), sftp(1), ssh-add(1), ssh-agent(1), ssh-keygen(1),
telnet(1), ssh_config(5), ssh-keysign(8), sshd(8)