sshd [-deiqtD46] [-b bits] [-f config_file]
[-g login_grace_seconds]
[-h host_key_file] [-k key_gen_seconds] [-o option] [-p port] [-u len]
Daemon service to provide secure encrypted communications between two untrusted hosts over an insecure network.
Started at boot from /etc/rc
, forks a new daemon for each incoming connection or by inetd?
.rhosts
,
.rhosts
combined with RSA host,
The client either requests a shell or execution of a command. The sides then enter session mode. In this mode, either side may send data at any time, and such data is forwarded to/from the shell or command on the server side, and the user terminal in the client side.
When the user program terminates and all forwarded X11 and other connections have been closed, the server sends command exit status to the client, and both sides exit.
The configuration file is re-read on receipt of a hangup signal, (killall --signal SIGHUP --verbose sshd
) which disconnects current sessions.
Command line options are for debugging. | |||||||||||||||||||||||||||||||||
-d |
/etc/motd
/etc/nologin
exists, outputs it and quits (unless root).
$HOME/.ssh/environment
if users are
allowed to change their environment. See
PermitUserEnvironment
.
CD ~
$HOME/.ssh/rc
or /etc/ssh/sshrc
or xauth
. The rc files are
given the X11 authentication protocol and cookie in standard input.
/etc/passwd
?.
/etc/nologin If this file exists, sshd refuses to let anyone except root log in. The contents of the file are displayed to anyone trying to log in, and non-root connections are refused, world-readable.
| ||||||||||||||||
$HOME/.ssh/authorized_keys Default file that lists the public keys for RSA authentication in protocol version 1 and for PubkeyAuthentication in protocol version 2.AuthorizedKeysFile may specify an alternative file.Empty lines and lines starting with a # are ignored as comments.
Each line contains seperated fields.
Lines are usually several hundred bytes long
(because of the size of the public key encoding). You don't want to type
them in; instead, copy
The case-insensitive options consist of comma-separated option specifications.
Examples of options1024 33 12121...312314325 ylo@foo.bar from="*.niksula.hut.fi,!pc.niksula.hut.fi" 1024 35 23...2334 ylo@niksula command="dump /home",no-pty,no-port-forwarding 1024 33 23...2323 backup.hut.fi permitopen="10.2.1.55:80",permitopen="10.2.1.56:25" 1024 33 23...2323 | ||||||||||||||||
/etc/ssh/ssh_known_hosts $HOME/.ssh/known_hosts contain
host public keys for all known hosts. The global file should be prepared
by the administrator (optional), and the per-user file is maintained
automatically: whenever the user connects from an unknown host its key is added to the per-user file.
Each line contains fields seperated by spaces: hostnames, bits, exponent, modulus, comment. Hostnames is a comma-separated list of patterns ('*' and '?' act as wildcards); each pattern in turn is matched against the canonical host name (when authenticating a client) or against the user-supplied name (when authenticating a server). A pattern may also be preceded by ''! to indicate negation: if the host name matches a negated pattern, it is not accepted (by that line) even if it matched another pattern on the line.
Bits, exponent, and modulus are taken directly from the RSA host key;
they can be obtained, e.g., from
Lines starting with
When performing host authentication, authentication is accepted if any
matching line has the proper key. It is thus permissible (but not recommended) to have several lines or different host keys for the same names.
The lines are typically VERY long.
Take them from Examples closenet,...,130.233.208.41 1024 37 159...93 closenet.hut.fi /etc/ssh/sshd_config
| ||||||||||||||||
/etc/ssh/ssh_host_key These contain the private parts of the host keys. These files should be owned by root, with permissions readable only by owner(user), and not accessible to others. sshd does not start if permissions include group/world access.
| ||||||||||||||||
/etc/ssh/ssh_host_key.pub /etc/ssh/ssh_host_rsa_key.pub Contain the public parts of the host keys. These files should be owned by root, with permissions writable only by user, other-readable . Their contents should match the respective private parts. They are provided for the convenience of users so their contents can be copied to known hosts files. Created using ssh-keygen .
| ||||||||||||||||
/etc/moduli Groups used for the "Diffie-Hellman Group Exchange", described in moduli. | ||||||||||||||||
/var/empty/sshd chroot(2) directory used by sshd during privilege separation in the pre-authentication phase. The directory should not contain any files and must be owned by root and not group or world- writable.
| ||||||||||||||||
$HOME/.ssh/authorized_keys Lists the public keys (RSA or DSA) that can be used to log into the user's account. It is recommended that it not be accessible by others. Must be readable by root (which may require being world-readable if the user's home directory resides on an NFS volume). Users place the contents of their identity.pub , id_dsa.pub and/or id_rsa.pub files into this file,
as described in ssh-keygen
| ||||||||||||||||
/etc/ssh/ssh_known_hosts Used with rhosts for RSA host authentication or protocol version 2 hostbased authentication to check
the public key of the host. The key must be listed in one of these files to be accepted. The client uses the same files to verify that it is connecting to the correct remote host. Permissions:These files should be owned by root and writable only by the owner. /etc/ssh/ssh_known_hosts should be world-readable, and$HOME/.ssh/known_hosts can, but need not be world-readable.
| ||||||||||||||||
/etc/hosts.allow Access controls that should be enforced by tcp-wrappers are defined here. See hosts_accessu.
| ||||||||||||||||
$HOME/.rhosts Contains host-username pairs, separated by a space, one per line. The given user on the corresponding host is permitted to log in without password. Used by rlogind and rshd .Permissions:owner Writable ; it is recommended that it not be accessible by others.
It is also possible to use netgroups in the file. host or
user name may be of the form
| ||||||||||||||||
$HOME/.shosts See $HOME/.rhosts Not used by rlogind or rshd .
| ||||||||||||||||
/etc/hosts.equiv Used during .rhosts authentication. In the simplest form, contains host names, one per line. Users from those hosts are permitted to log in without specifying their password, i.e. if they knew how to log in to host1.domain they are OK at host2.domain. The host name may also be followed by a user name; such users are permitted to log in as any user on this machine (except root). The syntax +@group can be used to specify netgroups. Negated entries start with - †
If the client host/user is successfully matched in this file,
login is automatically permitted provided the client and server
user names are the same. Additionally, successful RSA host
authentication is normally required.
Warning: It is almost never a good idea to use user names in
Note that this warning also applies to
| ||||||||||||||||
/etc/ssh/shosts.equiv Processed as /etc/hosts.equiv . Useful in environments that run both rsh/rlogin and ssh .
| ||||||||||||||||
| ||||||||||||||||
$HOME/.ssh/rc Run with /bin/sh after reading the
environment files but before starting the user's shell or command. It must not produce any output to stdout; stderr is permitted. If X11 forwarding is in use, it will receive the "proto cookie" pair in its standard input (and DISPLAY in its
environment) and must call xauth
The primary purpose of this file is to run any initialization routines which may be needed before the user's home directory becomes accessible; AFS is a particular example of such an environment. This file will probably contain some initialization code followed by something similar to: If this file does not exist,if read proto cookie && [ -n "$DISPLAY" ]; then if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then # X11UseLocalhost=yes echo add unix:`echo $DISPLAY | cut -c11-` $proto $cookie else # X11UseLocalhost=no echo add $DISPLAY $proto $cookie fi | xauth -q - fi /etc/ssh/sshrc is run, and if that
does not exist either, xauth is used to add the cookie.
Permissions:Writable only by the owner | ||||||||||||||||
/etc/ssh/sshrc Like $HOME/.ssh/rc . This can be used to specify machine-specific
login-time initializations globally. Permissions:owner root, owner writable and world-readable. | ||||||||||||||||
/var/run/sshd.pid Contains the process ID of the sshd listening for connections (if there are several daemons running concurrently for different ports, contains the process ID of the one started last). The content of this file is not sensitive; it can be world-readable.
|
rlogin
and rsh
.ssh
provides a secure connetion between hosts during a session.rshd
, rlogind
, and rexecd
are disabled.
OpenSSH is a derivative of the original and free ssh 1.2.12