.TH SSH 1 "June 12 2007 " ""
.SH NAME
\fBssh\fP
\- OpenSSH SSH client (remote login program)
.SH SYNOPSIS
.br
\fBssh\fP
[\fB\-1246AaCfgKkMNnqsTtVvXxY\fP]
[\fB\-b\fP \fIbind_address\fP]
[\fB\-c\fP \fIcipher_spec\fP]
[\fB\-D\\fP \& [\fIbind_address\fP:]
\fIport\fP
]
[\fB\-e\fP \fIescape_char\fP]
[\fB\-F\fP \fIconfigfile\fP]
[\fB\-i\fP \fIidentity_file\fP]
[\fB\-L\\fP \& [\fIbind_address\fP:]
\fIport\fP:host:hostport
]
[\fB\-l\fP \fIlogin_name\fP]
[\fB\-m\fP \fImac_spec\fP]
[\fB\-O\fP \fIctl_cmd\fP]
[\fB\-o\fP \fIoption\fP]
[\fB\-p\fP \fIport\fP]
[\fB\-R\\fP \& [\fIbind_address\fP:]
\fIport\fP:host:hostport
]
[\fB\-S\fP \fIctl_path\fP]
[\fB\-w\fP \fIlocal_tun\fP[:\fIremote_tun\fP]]
[\fIuser\fP@]\fIhostname\fP
[\fIcommand\fP]
.SH DESCRIPTION
\fBssh\fP
(SSH client) is a program for logging into a remote machine and for
executing commands on a remote machine.
It is intended to replace rlogin and rsh,
and provide secure encrypted communications between
two untrusted hosts over an insecure network.
X11 connections and arbitrary TCP ports
can also be forwarded over the secure channel.
\fBssh\fP
connects and logs into the specified
\fIhostname\fP
(with optional
\fIuser\fP
name).
The user must prove
his/her identity to the remote machine using one of several methods
depending on the protocol version used (see below).
If
\fIcommand\fP
is specified,
it is executed on the remote host instead of a login shell.
The options are as follows:
.TP
\fB\-1\fP
Forces
\fBssh\fP
to try protocol version 1 only.
.TP
\fB\-2\fP
Forces
\fBssh\fP
to try protocol version 2 only.
.TP
\fB\-4\fP
Forces
\fBssh\fP
to use IPv4 addresses only.
.TP
\fB\-6\fP
Forces
\fBssh\fP
to use IPv6 addresses only.
.TP
\fB\-A\fP
Enables forwarding of the authentication agent connection.
This can also be specified on a per-host basis in a configuration file.
Agent forwarding should be enabled with caution.
Users with the ability to bypass file permissions on the remote host
(for the agent's Unix-domain socket)
can access the local agent through the forwarded connection.
An attacker cannot obtain key material from the agent,
however they can perform operations on the keys that enable them to
authenticate using the identities loaded into the agent.
.TP
\fB\-a\fP
Disables forwarding of the authentication agent connection.
.TP
\fB\-b\fP \fIbind_address\fP
Use
\fIbind_address\fP
on the local machine as the source address
of the connection.
Only useful on systems with more than one address.
.TP
\fB\-C\fP
Requests compression of all data (including stdin, stdout, stderr, and
data for forwarded X11 and TCP connections).
The compression algorithm is the same used by
\fBgzip\fP(1),
and the
``level''
can be controlled by the
\fBCompressionLevel\fP
option for protocol version 1.
Compression is desirable on modem lines and other
slow connections, but will only slow down things on fast networks.
The default value can be set on a host-by-host basis in the
configuration files; see the
\fBCompression\fP
option.
.TP
\fB\-c\fP \fIcipher_spec\fP
Selects the cipher specification for encrypting the session.
Protocol version 1 allows specification of a single cipher.
The supported values are
``3des'',
``blowfish'',
and
``des''.
\fI3des\fP
(triple-des) is an encrypt-decrypt-encrypt triple with three different keys.
It is believed to be secure.
\fIblowfish\fP
is a fast block cipher; it appears very secure and is much faster than
\fI3des\fP.
\fIdes\fP
is only supported in the
\fBssh\fP
client for interoperability with legacy protocol 1 implementations
that do not support the
\fI3des\fP
cipher.
Its use is strongly discouraged due to cryptographic weaknesses.
The default is
``3des''.
For protocol version 2,
\fIcipher_spec\fP
is a comma-separated list of ciphers
listed in order of preference.
The supported ciphers are:
3des-cbc,
aes128-cbc,
aes192-cbc,
aes256-cbc,
aes128-ctr,
aes192-ctr,
aes256-ctr,
arcfour128,
arcfour256,
arcfour,
blowfish-cbc,
and
cast128-cbc.
The default is:
aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,
.br
arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr,
.br
aes192-ctr,aes256-ctr
.br
.TP
\fB\-D\fP [\fIbind_address\fP:] \fIport\fP
Specifies a local
``dynamic''
application-level port forwarding.
This works by allocating a socket to listen to
\fIport\fP
on the local side, optionally bound to the specified
\fIbind_address\fP.
Whenever a connection is made to this port, the
connection is forwarded over the secure channel, and the application
protocol is then used to determine where to connect to from the
remote machine.
Currently the SOCKS4 and SOCKS5 protocols are supported, and
\fBssh\fP
will act as a SOCKS server.
Only root can forward privileged ports.
Dynamic port forwardings can also be specified in the configuration file.
IPv6 addresses can be specified with an alternative syntax:
[\fIbind_address\fP/] \fIport\fP
or by enclosing the address in square brackets.
Only the superuser can forward privileged ports.
By default, the local port is bound in accordance with the
\fBGatewayPorts\fP
setting.
However, an explicit
\fIbind_address\fP
may be used to bind the connection to a specific address.
The
\fIbind_address\fP
of
``localhost''
indicates that the listening port be bound for local use only, while an
empty address or
`*'
indicates that the port should be available from all interfaces.
.TP
\fB\-e\fP \fIescape_char\fP
Sets the escape character for sessions with a pty (default:
`~' ) .
The escape character is only recognized at the beginning of a line.
The escape character followed by a dot
(`\&.')
closes the connection;
followed by control-Z suspends the connection;
and followed by itself sends the escape character once.
Setting the character to
``none''
disables any escapes and makes the session fully transparent.
.TP
\fB\-F\fP \fIconfigfile\fP
Specifies an alternative per-user configuration file.
If a configuration file is given on the command line,
the system-wide configuration file
(\fI/etc/ssh/ssh_config\fP)
will be ignored.
The default for the per-user configuration file is
\fI~/.ssh/config\fP.
.TP
\fB\-f\fP
Requests
\fBssh\fP
to go to background just before command execution.
This is useful if
\fBssh\fP
is going to ask for passwords or passphrases, but the user
wants it in the background.
This implies
\fB\-n\fP.
The recommended way to start X11 programs at a remote site is with
something like
\fBssh -f host xterm\fP.
.TP
\fB\-g\fP
Allows remote hosts to connect to local forwarded ports.
.TP
\fB\-I\fP \fIsmartcard_device\fP
Specify the device
\fBssh\fP
should use to communicate with a smartcard used for storing the user's
private RSA key.
This option is only available if support for smartcard devices
is compiled in (default is no support).
.TP
\fB\-i\fP \fIidentity_file\fP
Selects a file from which the identity (private key) for
RSA or DSA authentication is read.
The default is
\fI~/.ssh/identity\fP
for protocol version 1, and
\fI~/.ssh/id_rsa\fP
and
\fI~/.ssh/id_dsa\fP
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
\fB\-i\fP
options (and multiple identities specified in
configuration files).
.TP
\fB\-K\fP
Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI
credentials to the server.
.TP
\fB\-k\fP
Disables forwarding (delegation) of GSSAPI credentials to the server.
.TP
\fB\-L\fP [\fIbind_address\fP:] \fIport\fP:host:hostport
Specifies that the given port on the local (client) host is to be
forwarded to the given host and port on the remote side.
This works by allocating a socket to listen to
\fIport\fP
on the local side, optionally bound to the specified
\fIbind_address\fP.
Whenever a connection is made to this port, the
connection is forwarded over the secure channel, and a connection is
made to
\fIhost\fP
port
\fIhostport\fP
from the remote machine.
Port forwardings can also be specified in the configuration file.
IPv6 addresses can be specified with an alternative syntax:
[\fIbind_address\fP/] \fIport\fP/\fIhost\fP/ \fIhostport\fP
or by enclosing the address in square brackets.
Only the superuser can forward privileged ports.
By default, the local port is bound in accordance with the
\fBGatewayPorts\fP
setting.
However, an explicit
\fIbind_address\fP
may be used to bind the connection to a specific address.
The
\fIbind_address\fP
of
``localhost''
indicates that the listening port be bound for local use only, while an
empty address or
`*'
indicates that the port should be available from all interfaces.
.TP
\fB\-l\fP \fIlogin_name\fP
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.
.TP
\fB\-M\fP
Places the
\fBssh\fP
client into
``master''
mode for connection sharing.
Multiple
\fB\-M\fP
options places
\fBssh\fP
into
``master''
mode with confirmation required before slave connections are accepted.
Refer to the description of
\fBControlMaster\fP
in
\fBssh_config\fP(5)
for details.
.TP
\fB\-m\fP \fImac_spec\fP
Additionally, for protocol version 2 a comma-separated list of MAC
(message authentication code) algorithms can
be specified in order of preference.
See the
\fBMACs\fP
keyword for more information.
.TP
\fB\-N\fP
Do not execute a remote command.
This is useful for just forwarding ports
(protocol version 2 only).
.TP
\fB\-n\fP
Redirects stdin from
\fI/dev/null\fP
(actually, prevents reading from stdin).
This must be used when
\fBssh\fP
is run in the background.
A common trick is to use this to run X11 programs on a remote machine.
For example,
\fBssh -n shadows.cs.hut.fi emacs &\fP
will start an emacs on shadows.cs.hut.fi, and the X11
connection will be automatically forwarded over an encrypted channel.
The
\fBssh\fP
program will be put in the background.
(This does not work if
\fBssh\fP
needs to ask for a password or passphrase; see also the
\fB\-f\fP
option.)
.TP
\fB\-O\fP \fIctl_cmd\fP
Control an active connection multiplexing master process.
When the
\fB\-O\fP
option is specified, the
\fIctl_cmd\fP
argument is interpreted and passed to the master process.
Valid commands are:
``check''
(check that the master process is running) and
``exit''
(request the master to exit).
.TP
\fB\-o\fP \fIoption\fP
Can be used to give options in the format used in the configuration file.
This is useful for specifying options for which there is no separate
command-line flag.
For full details of the options listed below, and their possible values, see
\fBssh_config\fP(5).
.TP
AddressFamily
.TP
BatchMode
.TP
BindAddress
.TP
ChallengeResponseAuthentication
.TP
CheckHostIP
.TP
Cipher
.TP
Ciphers
.TP
ClearAllForwardings
.TP
Compression
.TP
CompressionLevel
.TP
ConnectionAttempts
.TP
ConnectTimeout
.TP
ControlMaster
.TP
ControlPath
.TP
DynamicForward
.TP
EscapeChar
.TP
ExitOnForwardFailure
.TP
ForwardAgent
.TP
ForwardX11
.TP
ForwardX11Trusted
.TP
GatewayPorts
.TP
GlobalKnownHostsFile
.TP
GSSAPIAuthentication
.TP
GSSAPIDelegateCredentials
.TP
HashKnownHosts
.TP
Host
.TP
HostbasedAuthentication
.TP
HostKeyAlgorithms
.TP
HostKeyAlias
.TP
HostName
.TP
IdentityFile
.TP
IdentitiesOnly
.TP
KbdInteractiveDevices
.TP
LocalCommand
.TP
LocalForward
.TP
LogLevel
.TP
MACs
.TP
NoHostAuthenticationForLocalhost
.TP
NumberOfPasswordPrompts
.TP
PasswordAuthentication
.TP
PermitLocalCommand
.TP
Port
.TP
PreferredAuthentications
.TP
Protocol
.TP
ProxyCommand
.TP
PubkeyAuthentication
.TP
RekeyLimit
.TP
RemoteForward
.TP
RhostsRSAAuthentication
.TP
RSAAuthentication
.TP
SendEnv
.TP
ServerAliveInterval
.TP
ServerAliveCountMax
.TP
SmartcardDevice
.TP
StrictHostKeyChecking
.TP
TCPKeepAlive
.TP
Tunnel
.TP
TunnelDevice
.TP
UsePrivilegedPort
.TP
User
.TP
UserKnownHostsFile
.TP
VerifyHostKeyDNS
.TP
XAuthLocation
.TP
\fB\-p\fP \fIport\fP
Port to connect to on the remote host.
This can be specified on a
per-host basis in the configuration file.
.TP
\fB\-q\fP
Quiet mode.
Causes all warning and diagnostic messages to be suppressed.
.TP
\fB\-R\fP [\fIbind_address\fP:] \fIport\fP:host:hostport
Specifies that the given port on the remote (server) host is to be
forwarded to the given host and port on the local side.
This works by allocating a socket to listen to
\fIport\fP
on the remote side, and whenever a connection is made to this port, the
connection is forwarded over the secure channel, and a connection is
made to
\fIhost\fP
port
\fIhostport\fP
from the local machine.
Port forwardings can also be specified in the configuration file.
Privileged ports can be forwarded only when
logging in as root on the remote machine.
IPv6 addresses can be specified by enclosing the address in square braces or
using an alternative syntax:
[\fIbind_address\fP/] \fIhost\fP/\fIport\fP/ \fIhostport\fP
By default, the listening socket on the server will be bound to the loopback
interface only.
This may be overriden by specifying a
\fIbind_address\fP.
An empty
\fIbind_address\fP,
or the address
`*',
indicates that the remote socket should listen on all interfaces.
Specifying a remote
\fIbind_address\fP
will only succeed if the server's
\fBGatewayPorts\fP
option is enabled (see
\fBsshd_config\fP(5)) .
.TP
\fB\-S\fP \fIctl_path\fP
Specifies the location of a control socket for connection sharing.
Refer to the description of
\fBControlPath\fP
and
\fBControlMaster\fP
in
\fBssh_config\fP(5)
for details.
.TP
\fB\-s\fP
May be used to request invocation of a subsystem on the remote system.
Subsystems are a feature of the SSH2 protocol which facilitate the use
of SSH as a secure transport for other applications (eg.\&
\fBsftp\fP(1)) .
The subsystem is specified as the remote command.
.TP
\fB\-T\fP
Disable pseudo-tty allocation.
.TP
\fB\-t\fP
Force pseudo-tty allocation.
This can be used to execute arbitrary
screen-based programs on a remote machine, which can be very useful,
e.g. when implementing menu services.
Multiple
\fB\-t\fP
options force tty allocation, even if
\fBssh\fP
has no local tty.
.TP
\fB\-V\fP
Display the version number and exit.
.TP
\fB\-v\fP
Verbose mode.
Causes
\fBssh\fP
to print debugging messages about its progress.
This is helpful in
debugging connection, authentication, and configuration problems.
Multiple
\fB\-v\fP
options increase the verbosity.
The maximum is 3.
.TP
\fB\-w\fP \fIlocal_tun\fP[:\fIremote_tun\fP]
Requests
tunnel
device forwarding with the specified
\fBtun\fP(4)
devices between the client
(\fIlocal_tun\fP)
and the server
(\fIremote_tun\fP.)
The devices may be specified by numerical ID or the keyword
``any'',
which uses the next available tunnel device.
If
\fIremote_tun\fP
is not specified, it defaults to
``any''.
See also the
\fBTunnel\fP
and
\fBTunnelDevice\fP
directives in
\fBssh_config\fP(5).
If the
\fBTunnel\fP
directive is unset, it is set to the default tunnel mode, which is
``point-to-point''.
.TP
\fB\-X\fP
Enables X11 forwarding.
This can also be specified on a per-host basis in a configuration file.
X11 forwarding should be enabled with caution.
Users with the ability to bypass file permissions on the remote host
(for the user's X authorization database)
can access the local X11 display through the forwarded connection.
An attacker may then be able to perform activities such as keystroke monitoring.
For this reason, X11 forwarding is subjected to X11 SECURITY extension
restrictions by default.
Please refer to the
\fBssh\fP
\fB\-Y\fP
option and the
\fBForwardX11Trusted\fP
directive in
\fBssh_config\fP(5)
for more information.
.TP
\fB\-x\fP
Disables X11 forwarding.
.TP
\fB\-Y\fP
Enables trusted X11 forwarding.
Trusted X11 forwardings are not subjected to the X11 SECURITY extension
controls.
\fBssh\fP
may additionally obtain configuration data from
a per-user configuration file and a system-wide configuration file.
The file format and configuration options are described in
\fBssh_config\fP(5).
\fBssh\fP
exits with the exit status of the remote command or with 255
if an error occurred.
.SH AUTHENTICATION
The OpenSSH SSH client supports SSH protocols 1 and 2.
Protocol 2 is the default, with
\fBssh\fP
falling back to protocol 1 if it detects protocol 2 is unsupported.
These settings may be altered using the
\fBProtocol\fP
option in
\fBssh_config\fP(5),
or enforced using the
\fB\-1\fP
and
\fB\-2\fP
options (see above).
Both protocols support similar authentication methods,
but protocol 2 is preferred since
it provides additional mechanisms for confidentiality
(the traffic is encrypted using AES, 3DES, Blowfish, CAST128, or Arcfour)
and integrity (hmac-md5, hmac-sha1, umac-64, hmac-ripemd160).
Protocol 1 lacks a strong mechanism for ensuring the
integrity of the connection.
The methods available for authentication are:
GSSAPI-based authentication,
host-based authentication,
public key authentication,
challenge-response authentication,
and password authentication.
Authentication methods are tried in the order specified above,
though protocol 2 has a configuration option to change the default order:
\fBPreferredAuthentications\fP.
Host-based authentication works as follows:
If the machine the user logs in from is listed in
\fI/etc/hosts.equiv\fP
or
\fI/etc/shosts.equiv\fP
on the remote machine, and the user names are
the same on both sides, or if the files
\fI~/.rhosts\fP
or
\fI~/.shosts\fP
exist in the user's home directory on the
remote machine and contain a line containing the name of the client
machine and the name of the user on that machine, the user is
considered for login.
Additionally, the server
.IR must
be able to verify the client's
host key (see the description of
\fI/etc/ssh/ssh_known_hosts\fP
and
\fI~/.ssh/known_hosts\fP,
below)
for login to be permitted.
This authentication method closes security holes due to IP
spoofing, DNS spoofing, and routing spoofing.
[Note to the administrator:
\fI/etc/hosts.equiv\fP,
\fI~/.rhosts\fP,
and the rlogin/rsh protocol in general, are inherently insecure and should be
disabled if security is desired.]
Public key authentication works as follows:
The scheme is based on public-key cryptography,
using cryptosystems
where encryption and decryption are done using separate keys,
and it is unfeasible to derive the decryption key from the encryption key.
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.
\fBssh\fP
implements public key authentication protocol automatically,
using either the RSA or DSA algorithms.
Protocol 1 is restricted to using only RSA keys,
but protocol 2 may use either.
The
.B HISTORY
section of
\fBssl\fP(8)
contains a brief discussion of the two algorithms.
The file
\fI~/.ssh/authorized_keys\fP
lists the public keys that are permitted for logging in.
When the user logs in, the
\fBssh\fP
program tells the server which key pair it would like to use for
authentication.
The client proves that it has access to the private key
and the server checks that the corresponding public key
is authorized to accept the account.
The user creates his/her key pair by running
\fBssh-keygen\fP(1).
This stores the private key in
\fI~/.ssh/identity\fP
(protocol 1),
\fI~/.ssh/id_dsa\fP
(protocol 2 DSA),
or
\fI~/.ssh/id_rsa\fP
(protocol 2 RSA)
and stores the public key in
\fI~/.ssh/identity.pub\fP
(protocol 1),
\fI~/.ssh/id_dsa.pub\fP
(protocol 2 DSA),
or
\fI~/.ssh/id_rsa.pub\fP
(protocol 2 RSA)
in the user's home directory.
The user should then copy the public key
to
\fI~/.ssh/authorized_keys\fP
in his/her home directory on the remote machine.
The
\fIauthorized_keys\fP
file corresponds to the conventional
\fI~/.rhosts\fP
file, and has one key
per line, though the lines can be very long.
After this, the user can log in without giving the password.
The most convenient way to use public key authentication may be with an
authentication agent.
See
\fBssh-agent\fP(1)
for more information.
Challenge-response authentication works as follows:
The server sends an arbitrary
Qq challenge
text, and prompts for a response.
Protocol 2 allows multiple challenges and responses;
protocol 1 is restricted to just one challenge/response.
Examples of challenge-response authentication include
BSD Authentication (see
\fBlogin.conf\fP(5))
and PAM (some non-OpenBSD systems).
Finally, if other authentication methods fail,
\fBssh\fP
prompts the user for a password.
The password is sent to the remote
host for checking; however, since all communications are encrypted,
the password cannot be seen by someone listening on the network.
\fBssh\fP
automatically maintains and checks a database containing
identification for all hosts it has ever been used with.
Host keys are stored in
\fI~/.ssh/known_hosts\fP
in the user's home directory.
Additionally, the file
\fI/etc/ssh/ssh_known_hosts\fP
is automatically checked for known hosts.
Any new hosts are automatically added to the user's file.
If a host's identification ever changes,
\fBssh\fP
warns about this and disables password authentication to prevent
server spoofing or man-in-the-middle attacks,
which could otherwise be used to circumvent the encryption.
The
\fBStrictHostKeyChecking\fP
option can be used to control logins to machines whose
host key is not known or has changed.
When the user's identity has been accepted by the server, the server
either executes the given command, or logs into the machine and gives
the user a normal shell on the remote machine.
All communication with
the remote command or shell will be automatically encrypted.
If a pseudo-terminal has been allocated (normal login session), the
user may use the escape characters noted below.
If no pseudo-tty has been allocated,
the session is transparent and can be used to reliably transfer binary data.
On most systems, setting the escape character to
``none''
will also make the session transparent even if a tty is used.
The session terminates when the command or shell on the remote
machine exits and all X11 and TCP connections have been closed.
.SH ESCAPE CHARACTERS
When a pseudo-terminal has been requested,
\fBssh\fP
supports a number of functions through the use of an escape character.
A single tilde character can be sent as
\fB~~\fP
or by following the tilde by a character other than those described below.
The escape character must always follow a newline to be interpreted as
special.
The escape character can be changed in configuration files using the
\fBEscapeChar\fP
configuration directive or on the command line by the
\fB\-e\fP
option.
The supported escapes (assuming the default
`~' )
are:
.TP
\fB~.\fP
Disconnect.
.TP
\fB~^Z\fP
Background
\fB.\fP
.TP
\fB~#\fP
List forwarded connections.
.TP
\fB~&\fP
Background
\fBssh\fP
at logout when waiting for forwarded connection / X11 sessions to terminate.
.TP
\fB~?\fP
Display a list of escape characters.
.TP
\fB~B\fP
Send a BREAK to the remote system
(only useful for SSH protocol version 2 and if the peer supports it).
.TP
\fB~C\fP
Open command line.
Currently this allows the addition of port forwardings using the
\fB\-L\fP
and
\fB\-R\fP
options (see above).
It also allows the cancellation of existing remote port-forwardings
using
\fB\-KR\fP[\fIbind_address\fP:]\fIport\fP.
\fB!\& Ns \fIcommand\fP\fP
allows the user to execute a local command if the
\fBPermitLocalCommand\fP
option is enabled in
\fBssh_config\fP(5).
Basic help is available, using the
\fB\-h\fP
option.
.TP
\fB~R\fP
Request rekeying of the connection
(only useful for SSH protocol version 2 and if the peer supports it).
.SH TCP FORWARDING
Forwarding of arbitrary TCP connections over the secure channel can
be specified either on the command line or in a configuration file.
One possible application of TCP forwarding is a secure connection to a
mail server; another is going through firewalls.
In the example below, we look at encrypting communication between
an IRC client and server, even though the IRC server does not directly
support encrypted communications.
This works as follows:
the user connects to the remote host using
\fB,\fP
specifying a port to be used to forward connections
to the remote server.
After that it is possible to start the service which is to be encrypted
on the client machine,
connecting to the same local port,
and
\fBssh\fP
will encrypt and forward the connection.
The following example tunnels an IRC session from client machine
``127.0.0.1''
(localhost)
to remote server
``server.example.com :''
$ ssh -f -L 1234:localhost:6667 server.example.com sleep 10
.br
$ irc -c '#users' -p 1234 pinky 127.0.0.1
.br
This tunnels a connection to IRC server
``server.example.com'',
joining channel
``#users'',
nickname
``pinky'',
using port 1234.
It doesn't matter which port is used,
as long as it's greater than 1023
(remember, only root can open sockets on privileged ports)
and doesn't conflict with any ports already in use.
The connection is forwarded to port 6667 on the remote server,
since that's the standard port for IRC services.
The
\fB\-f\fP
option backgrounds
\fBssh\fP
and the remote command
``sleep 10''
is specified to allow an amount of time
(10 seconds, in the example)
to start the service which is to be tunnelled.
If no connections are made within the time specified,
\fBssh\fP
will exit.
.SH X11 FORWARDING
If the
\fBForwardX11\fP
variable is set to
``yes''
(or see the description of the
\fB\-X\fP,
\fB\-x\fP,
and
\fB\-Y\fP
options above)
and the user is using X11 (the
.IR DISPLAY
environment variable is set), the connection to the X11 display is
automatically forwarded to the remote side in such a way that any X11
programs started from the shell (or command) will go through the
encrypted channel, and the connection to the real X server will be made
from the local machine.
The user should not manually set
.IR DISPLAY .
Forwarding of X11 connections can be
configured on the command line or in configuration files.
The
.IR DISPLAY
value set by
\fBssh\fP
will point to the server machine, but with a display number greater than zero.
This is normal, and happens because
\fBssh\fP
creates a
``proxy''
X server on the server machine for forwarding the
connections over the encrypted channel.
\fBssh\fP
will also automatically set up Xauthority data on the server machine.
For this purpose, it will generate a random authorization cookie,
store it in Xauthority on the server, and verify that any forwarded
connections carry this cookie and replace it by the real cookie when
the connection is opened.
The real authentication cookie is never
sent to the server machine (and no cookies are sent in the plain).
If the
\fBForwardAgent\fP
variable is set to
``yes''
(or see the description of the
\fB\-A\fP
and
\fB\-a\fP
options above) and
the user is using an authentication agent, the connection to the agent
is automatically forwarded to the remote side.
.SH VERIFYING HOST KEYS
When connecting to a server for the first time,
a fingerprint of the server's public key is presented to the user
(unless the option
\fBStrictHostKeyChecking\fP
has been disabled).
Fingerprints can be determined using
\fBssh-keygen\fP(1):
Dl $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key
If the fingerprint is already known,
it can be matched and verified,
and the key can be accepted.
If the fingerprint is unknown,
an alternative method of verification is available:
SSH fingerprints verified by DNS.
An additional resource record (RR),
SSHFP,
is added to a zonefile
and the connecting client is able to match the fingerprint
with that of the key presented.
In this example, we are connecting a client to a server,
``host.example.com''.
The SSHFP resource records should first be added to the zonefile for
host.example.com:
$ ssh-keygen -r host.example.com.
.br
The output lines will have to be added to the zonefile.
To check that the zone is answering fingerprint queries:
Dl $ dig -t SSHFP host.example.com
Finally the client connects:
$ ssh -o "VerifyHostKeyDNS ask" host.example.com
.br
[...]
.br
Matching host key fingerprint found in DNS.
.br
Are you sure you want to continue connecting (yes/no)?
.br
See the
\fBVerifyHostKeyDNS\fP
option in
\fBssh_config\fP(5)
for more information.
.SH SSH-BASED VIRTUAL PRIVATE NETWORKS
\fBssh\fP
contains support for Virtual Private Network (VPN) tunnelling
using the
\fBtun\fP(4)
network pseudo-device,
allowing two networks to be joined securely.
The
\fBsshd_config\fP(5)
configuration option
\fBPermitTunnel\fP
controls whether the server supports this,
and at what level (layer 2 or 3 traffic).
The following example would connect client network 10.0.50.0/24
with remote network 10.0.99.0/24 using a point-to-point connection
from 10.1.1.1 to 10.1.1.2,
provided that the SSH server running on the gateway to the remote network,
at 192.168.1.15, allows it.
On the client:
# ssh -f -w 0:1 192.168.1.15 true
.br
# ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252
.br
# route add 10.0.99.0/24 10.1.1.2
.br
On the server:
# ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252
.br
# route add 10.0.50.0/24 10.1.1.1
.br
Client access may be more finely tuned via the
\fI/root/.ssh/authorized_keys\fP
file (see below) and the
\fBPermitRootLogin\fP
server option.
The following entry would permit connections on
\fBtun\fP(4)
device 1 from user
``jane''
and on tun device 2 from user
``john'',
if
\fBPermitRootLogin\fP
is set to
``forced-commands-only :''
tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane
.br
tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john
.br
Since an SSH-based setup entails a fair amount of overhead,
it may be more suited to temporary setups,
such as for wireless VPNs.
More permanent VPNs are better provided by tools such as
\fBipsecctl\fP(8)
and
\fBisakmpd\fP(8).
.SH ENVIRONMENT
\fBssh\fP
will normally set the following environment variables:
.TP
.B DISPLAY
The
.IR DISPLAY
variable indicates the location of the X11 server.
It is automatically set by
\fBssh\fP
to point to a value of the form
``hostname:n'',
where
``hostname''
indicates the host where the shell runs, and
`n'
is an integer \*(Ge 1.
\fBssh\fP
uses this special value to forward X11 connections over the secure
channel.
The user should normally not set
.IR DISPLAY
explicitly, as that
will render the X11 connection insecure (and will require the user to
manually copy any required authorization cookies).
.TP
.B HOME
Set to the path of the user's home directory.
.TP
.B LOGNAME
Synonym for
.IR USER ;
set for compatibility with systems that use this variable.
.TP
.B MAIL
Set to the path of the user's mailbox.
.TP
.B PATH
Set to the default
.IR PATH ,
as specified when compiling
\fB.\fP
.TP
.B SSH_ASKPASS
If
\fBssh\fP
needs a passphrase, it will read the passphrase from the current
terminal if it was run from a terminal.
If
\fBssh\fP
does not have a terminal associated with it but
.IR DISPLAY
and
.IR SSH_ASKPASS
are set, it will execute the program specified by
.IR SSH_ASKPASS
and open an X11 window to read the passphrase.
This is particularly useful when calling
\fBssh\fP
from a
\fI\&.xsession\fP
or related script.
(Note that on some machines it
may be necessary to redirect the input from
\fI/dev/null\fP
to make this work.)
.TP
.B SSH_AUTH_SOCK
Identifies the path of a
Ux-domain
socket used to communicate with the agent.
.TP
.B SSH_CONNECTION
Identifies the client and server ends of the connection.
The variable contains
four space-separated values: client IP address, client port number,
server IP address, and server port number.
.TP
.B SSH_ORIGINAL_COMMAND
This variable contains the original command line if a forced command
is executed.
It can be used to extract the original arguments.
.TP
.B SSH_TTY
This is set to the name of the tty (path to the device) associated
with the current shell or command.
If the current session has no tty,
this variable is not set.
.TP
.B TZ
This variable is set to indicate the present time zone if it
was set when the daemon was started (i.e. the daemon passes the value
on to new connections).
.TP
.B USER
Set to the name of the user logging in.
Additionally,
\fBssh\fP
reads
\fI~/.ssh/environment\fP,
and adds lines of the format
``VARNAME=value''
to the environment if the file exists and users are allowed to
change their environment.
For more information, see the
\fBPermitUserEnvironment\fP
option in
\fBsshd_config\fP(5).
.SH FILES
.TP
~/.rhosts
This file is used for host-based authentication (see above).
On some machines this file may need to be
world-readable if the user's home directory is on an NFS partition,
because
\fBsshd\fP(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.
.TP
~/.shosts
This file is used in exactly the same way as
\fI\&.rhosts\fP,
but allows host-based authentication without permitting login with
rlogin/rsh.
.TP
~/.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
\fBsshd\fP(8)
manual page.
This file is not highly sensitive, but the recommended
permissions are read/write for the user, and not accessible by others.
.TP
~/.ssh/config
This is the per-user configuration file.
The file format and configuration options are described in
\fBssh_config\fP(5).
Because of the potential for abuse, this file must have strict permissions:
read/write for the user, and not accessible by others.
.TP
~/.ssh/environment
Contains additional definitions for environment variables; see
.B ENVIRONMENT ,
above.
.TP
~/.ssh/identity
.TP
~/.ssh/id_dsa
.TP
~/.ssh/id_rsa
Contains the private key for authentication.
These files
contain sensitive data and should be readable by the user but not
accessible by others (read/write/execute).
\fBssh\fP
will simply ignore a private key file if it is accessible by others.
It is possible to specify a passphrase when
generating the key which will be used to encrypt the
sensitive part of this file using 3DES.
.TP
~/.ssh/identity.pub
.TP
~/.ssh/id_dsa.pub
.TP
~/.ssh/id_rsa.pub
Contains the public key for authentication.
These files are not
sensitive and can (but need not) be readable by anyone.
.TP
~/.ssh/known_hosts
Contains a list of host keys for all hosts the user has logged into
that are not already in the systemwide list of known host keys.
See
\fBsshd\fP(8)
for further details of the format of this file.
.TP
~/.ssh/rc
Commands in this file are executed by
\fBssh\fP
when the user logs in, just before the user's shell (or command) is
started.
See the
\fBsshd\fP(8)
manual page for more information.
.TP
/etc/hosts.equiv
This file is for host-based authentication (see above).
It should only be writable by root.
.TP
/etc/shosts.equiv
This file is used in exactly the same way as
\fIhosts.equiv\fP,
but allows host-based authentication without permitting login with
rlogin/rsh.
.TP
.B /etc/ssh/ssh_config
Systemwide configuration file.
The file format and configuration options are described in
\fBssh_config\fP(5).
.TP
/etc/ssh/ssh_host_key
.TP
/etc/ssh/ssh_host_dsa_key
.TP
/etc/ssh/ssh_host_rsa_key
These three files contain the private parts of the host keys
and are used for host-based authentication.
If protocol version 1 is used,
\fBssh\fP
must be setuid root, since the host key is readable only by root.
For protocol version 2,
\fBssh\fP
uses
\fBssh-keysign\fP(8)
to access the host keys,
eliminating the requirement that
\fBssh\fP
be setuid root when host-based authentication is used.
By default
\fBssh\fP
is not setuid root.
.TP
/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.
It should be world-readable.
See
\fBsshd\fP(8)
for further details of the format of this file.
.TP
/etc/ssh/sshrc
Commands in this file are executed by
\fBssh\fP
when the user logs in, just before the user's shell (or command) is started.
See the
\fBsshd\fP(8)
manual page for more information.
.SH SEE ALSO
\fBscp\fP(1),
\fBsftp\fP(1),
\fBssh-add\fP(1),
\fBssh-agent\fP(1),
\fBssh-keygen\fP(1),
\fBssh-keyscan\fP(1),
\fBtun\fP(4),
\fBhosts.equiv\fP(5),
\fBssh_config\fP(5),
\fBssh-keysign\fP(8),
\fBsshd\fP(8)
\fIThe Secure Shell (SSH) Protocol Assigned Numbers\fP, RFC 4250, 2006.
\fIThe Secure Shell (SSH) Protocol Architecture\fP, RFC 4251, 2006.
\fIThe Secure Shell (SSH) Authentication Protocol\fP, RFC 4252, 2006.
\fIThe Secure Shell (SSH) Transport Layer Protocol\fP, RFC 4253, 2006.
\fIThe Secure Shell (SSH) Connection Protocol\fP, RFC 4254, 2006.
\fIUsing DNS to Securely Publish Secure Shell (SSH) Key Fingerprints\fP, RFC 4255, 2006.
\fIGeneric Message Exchange Authentication for the Secure Shell Protocol (SSH)\fP, RFC 4256, 2006.
\fIThe Secure Shell (SSH) Session Channel Break Extension\fP, RFC 4335, 2006.
\fIThe Secure Shell (SSH) Transport Layer Encryption Modes\fP, RFC 4344, 2006.
\fIImproved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol\fP, RFC 4345, 2006.
\fIDiffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol\fP, RFC 4419, 2006.
\fIThe Secure Shell (SSH) Public Key File Format\fP, RFC 4716, 2006.
.SH AUTHORS
OpenSSH is a derivative of the original and free
ssh 1.2.12 release by Tatu Ylonen.
Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
Theo de Raadt and Dug Song
removed many bugs, re-added newer features and
created OpenSSH.
Markus Friedl contributed the support for SSH
protocol versions 1.5 and 2.0.
.TH SCP 1 "August 8 2007 " ""
.SH NAME
\fBscp\fP
\- secure copy (remote file copy program)
.SH SYNOPSIS
.br
\fBscp\fP
[\fB\-1246BCpqrv\fP]
[\fB\-c\fP \fIcipher\fP]
[\fB\-F\fP \fIssh_config\fP]
[\fB\-i\fP \fIidentity_file\fP]
[\fB\-l\fP \fIlimit\fP]
[\fB\-o\fP \fIssh_option\fP]
[\fB\-P\fP \fIport\fP]
[\fB\-S\fP \fIprogram\fP]
[[\fIuser\fP@]\fIhost1\fP:]\fIfile1\fP
\fI...\fP
[[\fIuser\fP@]\fIhost2\fP:]\fIfile2\fP
.SH DESCRIPTION
\fBscp\fP
copies files between hosts on a network.
It uses
\fBssh\fP(1)
for data transfer, and uses the same authentication and provides the
same security as
\fBssh\fP(1).
Unlike
\fBrcp\fP(1),
\fBscp\fP
will ask for passwords or passphrases if they are needed for
authentication.
Any file name may contain a host and user specification to indicate
that the file is to be copied to/from that host.
Copies between two remote hosts are permitted.
The options are as follows:
.TP
\fB\-1\fP
Forces
\fBscp\fP
to use protocol 1.
.TP
\fB\-2\fP
Forces
\fBscp\fP
to use protocol 2.
.TP
\fB\-4\fP
Forces
\fBscp\fP
to use IPv4 addresses only.
.TP
\fB\-6\fP
Forces
\fBscp\fP
to use IPv6 addresses only.
.TP
\fB\-B\fP
Selects batch mode (prevents asking for passwords or passphrases).
.TP
\fB\-C\fP
Compression enable.
Passes the
\fB\-C\fP
flag to
\fBssh\fP(1)
to enable compression.
.TP
\fB\-c\fP \fIcipher\fP
Selects the cipher to use for encrypting the data transfer.
This option is directly passed to
\fBssh\fP(1).
.TP
\fB\-F\fP \fIssh_config\fP
Specifies an alternative
per-user configuration file for
\fBssh\fP.
This option is directly passed to
\fBssh\fP(1).
.TP
\fB\-i\fP \fIidentity_file\fP
Selects the file from which the identity (private key) for RSA
authentication is read.
This option is directly passed to
\fBssh\fP(1).
.TP
\fB\-l\fP \fIlimit\fP
Limits the used bandwidth, specified in Kbit/s.
.TP
\fB\-o\fP \fIssh_option\fP
Can be used to pass options to
\fBssh\fP
in the format used in
\fBssh_config\fP(5).
This is useful for specifying options
for which there is no separate
\fBscp\fP
command-line flag.
For full details of the options listed below, and their possible values, see
\fBssh_config\fP(5).
.TP
AddressFamily
.TP
BatchMode
.TP
BindAddress
.TP
ChallengeResponseAuthentication
.TP
CheckHostIP
.TP
Cipher
.TP
Ciphers
.TP
Compression
.TP
CompressionLevel
.TP
ConnectionAttempts
.TP
ConnectTimeout
.TP
ControlMaster
.TP
ControlPath
.TP
GlobalKnownHostsFile
.TP
GSSAPIAuthentication
.TP
GSSAPIDelegateCredentials
.TP
HashKnownHosts
.TP
Host
.TP
HostbasedAuthentication
.TP
HostKeyAlgorithms
.TP
HostKeyAlias
.TP
HostName
.TP
IdentityFile
.TP
IdentitiesOnly
.TP
KbdInteractiveDevices
.TP
LogLevel
.TP
MACs
.TP
NoHostAuthenticationForLocalhost
.TP
NumberOfPasswordPrompts
.TP
PasswordAuthentication
.TP
Port
.TP
PreferredAuthentications
.TP
Protocol
.TP
ProxyCommand
.TP
PubkeyAuthentication
.TP
RekeyLimit
.TP
RhostsRSAAuthentication
.TP
RSAAuthentication
.TP
SendEnv
.TP
ServerAliveInterval
.TP
ServerAliveCountMax
.TP
SmartcardDevice
.TP
StrictHostKeyChecking
.TP
TCPKeepAlive
.TP
UsePrivilegedPort
.TP
User
.TP
UserKnownHostsFile
.TP
VerifyHostKeyDNS
.TP
\fB\-P\fP \fIport\fP
Specifies the port to connect to on the remote host.
Note that this option is written with a capital
`P',
because
\fB\-p\fP
is already reserved for preserving the times and modes of the file in
\fBrcp\fP(1).
.TP
\fB\-p\fP
Preserves modification times, access times, and modes from the
original file.
.TP
\fB\-q\fP
Disables the progress meter.
.TP
\fB\-r\fP
Recursively copy entire directories.
.TP
\fB\-S\fP \fIprogram\fP
Name of
\fIprogram\fP
to use for the encrypted connection.
The program must understand
\fBssh\fP(1)
options.
.TP
\fB\-v\fP
Verbose mode.
Causes
\fBscp\fP
and
\fBssh\fP(1)
to print debugging messages about their progress.
This is helpful in
debugging connection, authentication, and configuration problems.
Ex -std scp
.SH SEE ALSO
\fBrcp\fP(1),
\fBsftp\fP(1),
\fBssh\fP(1),
\fBssh-add\fP(1),
\fBssh-agent\fP(1),
\fBssh-keygen\fP(1),
\fBssh_config\fP(5),
\fBsshd\fP(8)
.SH HISTORY
\fBscp\fP
is based on the
\fBrcp\fP(1)
program in BSD source code from the Regents of the University of
California.
.SH AUTHORS
Timo Rinne <[email protected]>
Tatu Ylonen <[email protected]>
.TH SFTP 1 "June 5 2007 " ""
.SH NAME
\fBsftp\fP
\- secure file transfer program
.SH SYNOPSIS
.br
\fBsftp\fP
[\fB\-1Cv\fP]
[\fB\-B\fP \fIbuffer_size\fP]
[\fB\-b\fP \fIbatchfile\fP]
[\fB\-F\fP \fIssh_config\fP]
[\fB\-o\fP \fIssh_option\fP]
[\fB\-P\fP \fIsftp_server_path\fP]
[\fB\-R\fP \fInum_requests\fP]
[\fB\-S\fP \fIprogram\fP]
[\fB\-s\fP \fIsubsystem\fP | \fIsftp_server\fP]
\fIhost\fP
.br
\fBsftp\fP
[[\fIuser\fP@]
\fIhost\fP[:\fIfile\fP[\fIfile\fP]]]
.br
\fBsftp\fP
[[\fIuser\fP@]
\fIhost\fP[:\fIdir\fP[\fI/\fP]]]
.br
\fBsftp\fP
\fB\-b\fP \fIbatchfile\fP
[\fIuser\fP@]\fIhost\fP
.SH DESCRIPTION
\fBsftp\fP
is an interactive file transfer program, similar to
\fBftp\fP(1),
which performs all operations over an encrypted
\fBssh\fP(1)
transport.
It may also use many features of ssh, such as public key authentication and
compression.
\fBsftp\fP
connects and logs into the specified
\fIhost\fP,
then enters an interactive command mode.
The second usage format will retrieve files automatically if a non-interactive
authentication method is used; otherwise it will do so after
successful interactive authentication.
The third usage format allows
\fBsftp\fP
to start in a remote directory.
The final usage format allows for automated sessions using the
\fB\-b\fP
option.
In such cases, it is necessary to configure non-interactive authentication
to obviate the need to enter a password at connection time (see
\fBsshd\fP(8)
and
\fBssh-keygen\fP(1)
for details).
The options are as follows:
.TP
\fB\-1\fP
Specify the use of protocol version 1.
.TP
\fB\-B\fP \fIbuffer_size\fP
Specify the size of the buffer that
\fBsftp\fP
uses when transferring files.
Larger buffers require fewer round trips at the cost of higher
memory consumption.
The default is 32768 bytes.
.TP
\fB\-b\fP \fIbatchfile\fP
Batch mode reads a series of commands from an input
\fIbatchfile\fP
instead of
.IR stdin .
Since it lacks user interaction it should be used in conjunction with
non-interactive authentication.
A
\fIbatchfile\fP
of
`\-'
may be used to indicate standard input.
\fBsftp\fP
will abort if any of the following
commands fail:
\fBget\fP, \fBput\fP, \fBrename\fP, \fBln\fP,
\fBrm\fP, \fBmkdir\fP, \fBchdir\fP, \fBls\fP,
\fBlchdir\fP, \fBchmod\fP, \fBchown\fP, \fBchgrp\fP, \fBlpwd\fP
and
\fBlmkdir\fP.
Termination on error can be suppressed on a command by command basis by
prefixing the command with a
`\-'
character (for example,
\fB-rm /tmp/blah* )\fP.
.TP
\fB\-C\fP
Enables compression (via ssh's
\fB\-C\fP
flag).
.TP
\fB\-F\fP \fIssh_config\fP
Specifies an alternative
per-user configuration file for
\fBssh\fP(1).
This option is directly passed to
\fBssh\fP(1).
.TP
\fB\-o\fP \fIssh_option\fP
Can be used to pass options to
\fBssh\fP
in the format used in
\fBssh_config\fP(5).
This is useful for specifying options
for which there is no separate
\fBsftp\fP
command-line flag.
For example, to specify an alternate port use:
\fBsftp -oPort=24\fP.
For full details of the options listed below, and their possible values, see
\fBssh_config\fP(5).
.TP
AddressFamily
.TP
BatchMode
.TP
BindAddress
.TP
ChallengeResponseAuthentication
.TP
CheckHostIP
.TP
Cipher
.TP
Ciphers
.TP
Compression
.TP
CompressionLevel
.TP
ConnectionAttempts
.TP
ConnectTimeout
.TP
ControlMaster
.TP
ControlPath
.TP
GlobalKnownHostsFile
.TP
GSSAPIAuthentication
.TP
GSSAPIDelegateCredentials
.TP
HashKnownHosts
.TP
Host
.TP
HostbasedAuthentication
.TP
HostKeyAlgorithms
.TP
HostKeyAlias
.TP
HostName
.TP
IdentityFile
.TP
IdentitiesOnly
.TP
KbdInteractiveDevices
.TP
LogLevel
.TP
MACs
.TP
NoHostAuthenticationForLocalhost
.TP
NumberOfPasswordPrompts
.TP
PasswordAuthentication
.TP
Port
.TP
PreferredAuthentications
.TP
Protocol
.TP
ProxyCommand
.TP
PubkeyAuthentication
.TP
RekeyLimit
.TP
RhostsRSAAuthentication
.TP
RSAAuthentication
.TP
SendEnv
.TP
ServerAliveInterval
.TP
ServerAliveCountMax
.TP
SmartcardDevice
.TP
StrictHostKeyChecking
.TP
TCPKeepAlive
.TP
UsePrivilegedPort
.TP
User
.TP
UserKnownHostsFile
.TP
VerifyHostKeyDNS
.TP
\fB\-P\fP \fIsftp_server_path\fP
Connect directly to a local sftp server
(rather than via
\fBssh\fP(1)) .
This option may be useful in debugging the client and server.
.TP
\fB\-R\fP \fInum_requests\fP
Specify how many requests may be outstanding at any one time.
Increasing this may slightly improve file transfer speed
but will increase memory usage.
The default is 16 outstanding requests.
.TP
\fB\-S\fP \fIprogram\fP
Name of the
\fIprogram\fP
to use for the encrypted connection.
The program must understand
\fBssh\fP(1)
options.
.TP
\fB\-s\fP \fIsubsystem\fP | \fIsftp_server\fP
Specifies the SSH2 subsystem or the path for an sftp server
on the remote host.
A path is useful for using
\fBsftp\fP
over protocol version 1, or when the remote
\fBsshd\fP(8)
does not have an sftp subsystem configured.
.TP
\fB\-v\fP
Raise logging level.
This option is also passed to ssh.
.SH INTERACTIVE COMMANDS
Once in interactive mode,
\fBsftp\fP
understands a set of commands similar to those of
\fBftp\fP(1).
Commands are case insensitive.
Pathnames that contain spaces must be enclosed in quotes.
Any special characters contained within pathnames that are recognized by
\fBglob\fP(3)
must be escaped with backslashes
(`\e'.)
.TP
\fBbye\fP
Quit
\fBsftp\fP.
.TP
\fBcd \fIpath\fP\fP
Change remote directory to
\fIpath\fP.
.TP
\fBchgrp \fIgrp\fP \fIpath\fP\fP
Change group of file
\fIpath\fP
to
\fIgrp\fP.
\fIpath\fP
may contain
\fBglob\fP(3)
characters and may match multiple files.
\fIgrp\fP
must be a numeric GID.
.TP
\fBchmod \fImode\fP \fIpath\fP\fP
Change permissions of file
\fIpath\fP
to
\fImode\fP.
\fIpath\fP
may contain
\fBglob\fP(3)
characters and may match multiple files.
.TP
\fBchown \fIown\fP \fIpath\fP\fP
Change owner of file
\fIpath\fP
to
\fIown\fP.
\fIpath\fP
may contain
\fBglob\fP(3)
characters and may match multiple files.
\fIown\fP
must be a numeric UID.
.TP
\fBexit\fP
Quit
\fBsftp\fP.
.TP
\fBget\fP [\fB\-P\fP] \fIremote-path\fP [\fIlocal-path\fP]
Retrieve the
\fIremote-path\fP
and store it on the local machine.
If the local
path name is not specified, it is given the same name it has on the
remote machine.
\fIremote-path\fP
may contain
\fBglob\fP(3)
characters and may match multiple files.
If it does and
\fIlocal-path\fP
is specified, then
\fIlocal-path\fP
must specify a directory.
If the
\fB\-P\fP
flag is specified, then full file permissions and access times are
copied too.
.TP
\fBhelp\fP
Display help text.
.TP
\fBlcd \fIpath\fP\fP
Change local directory to
\fIpath\fP.
.TP
\fBlls [\fIls-options\fP [\fIpath]]\fP\fP
Display local directory listing of either
\fIpath\fP
or current directory if
\fIpath\fP
is not specified.
\fIls-options\fP
may contain any flags supported by the local system's
\fBls\fP(1)
command.
\fIpath\fP
may contain
\fBglob\fP(3)
characters and may match multiple files.
.TP
\fBlmkdir \fIpath\fP\fP
Create local directory specified by
\fIpath\fP.
.TP
\fBln \fIoldpath\fP \fInewpath\fP\fP
Create a symbolic link from
\fIoldpath\fP
to
\fInewpath\fP.
.TP
\fBlpwd\fP
Print local working directory.
.TP
\fBls\fP [\fB\-1aflnrSt\fP] [\fIpath\fP]
Display a remote directory listing of either
\fIpath\fP
or the current directory if
\fIpath\fP
is not specified.
\fIpath\fP
may contain
\fBglob\fP(3)
characters and may match multiple files.
The following flags are recognized and alter the behaviour of
\fBls\fP
accordingly:
.TP
\fB\-1\fP
Produce single columnar output.
.TP
\fB\-a\fP
List files beginning with a dot
(`\&.'.)
.TP
\fB\-f\fP
Do not sort the listing.
The default sort order is lexicographical.
.TP
\fB\-l\fP
Display additional details including permissions
and ownership information.
.TP
\fB\-n\fP
Produce a long listing with user and group information presented
numerically.
.TP
\fB\-r\fP
Reverse the sort order of the listing.
.TP
\fB\-S\fP
Sort the listing by file size.
.TP
\fB\-t\fP
Sort the listing by last modification time.
.TP
\fBlumask \fIumask\fP\fP
Set local umask to
\fIumask\fP.
.TP
\fBmkdir \fIpath\fP\fP
Create remote directory specified by
\fIpath\fP.
.TP
\fBprogress\fP
Toggle display of progress meter.
.TP
\fBput\fP [\fB\-P\fP] \fIlocal-path\fP [\fIremote-path\fP]
Upload
\fIlocal-path\fP
and store it on the remote machine.
If the remote path name is not specified, it is given the same name it has
on the local machine.
\fIlocal-path\fP
may contain
\fBglob\fP(3)
characters and may match multiple files.
If it does and
\fIremote-path\fP
is specified, then
\fIremote-path\fP
must specify a directory.
If the
\fB\-P\fP
flag is specified, then the file's full permission and access time are
copied too.
.TP
\fBpwd\fP
Display remote working directory.
.TP
\fBquit\fP
Quit
\fBsftp\fP.
.TP
\fBrename \fIoldpath\fP \fInewpath\fP\fP
Rename remote file from
\fIoldpath\fP
to
\fInewpath\fP.
.TP
\fBrm \fIpath\fP\fP
Delete remote file specified by
\fIpath\fP.
.TP
\fBrmdir \fIpath\fP\fP
Remove remote directory specified by
\fIpath\fP.
.TP
\fBsymlink \fIoldpath\fP \fInewpath\fP\fP
Create a symbolic link from
\fIoldpath\fP
to
\fInewpath\fP.
.TP
\fBversion\fP
Display the
\fBsftp\fP
protocol version.
.TP
\fB\&! \fIcommand\fP\fP
Execute
\fIcommand\fP
in local shell.
.TP
\fB\&!\fP
Escape to local shell.
.TP
\fB\&?\fP
Synonym for help.
.SH SEE ALSO
\fBftp\fP(1),
\fBls\fP(1),
\fBscp\fP(1),
\fBssh\fP(1),
\fBssh-add\fP(1),
\fBssh-keygen\fP(1),
\fBglob\fP(3),
\fBssh_config\fP(5),
\fBsftp-server\fP(8),
\fBsshd\fP(8)
S. Lehtinen and T. Ylonen, \fISSH File Transfer Protocol\fP, draft-ietf-secsh-filexfer-00.txt, January 2001, work in progress material.
.TH SSH-ADD 1 "June 12 2007 " ""
.SH NAME
\fBssh-add\fP
\- adds RSA or DSA identities to the authentication agent
.SH SYNOPSIS
.br
\fBssh-add\fP
[\fB\-cDdLlXx\fP]
[\fB\-t\fP \fIlife\fP]
[\fIfile ...\fP]
.br
\fBssh-add\fP
\fB\-s\fP \fIreader\fP
.br
\fBssh-add\fP
\fB\-e\fP \fIreader\fP
.SH DESCRIPTION
\fBssh-add\fP
adds RSA or DSA identities to the authentication agent,
\fBssh-agent\fP(1).
When run without arguments, it adds the files
\fI~/.ssh/id_rsa\fP,
\fI~/.ssh/id_dsa\fP
and
\fI~/.ssh/identity\fP.
Alternative file names can be given on the command line.
If any file requires a passphrase,
\fBssh-add\fP
asks for the passphrase from the user.
The passphrase is read from the user's tty.
\fBssh-add\fP
retries the last passphrase if multiple identity files are given.
The authentication agent must be running and the
.IR SSH_AUTH_SOCK
environment variable must contain the name of its socket for
\fBssh-add\fP
to work.
The options are as follows:
.TP
\fB\-c\fP
Indicates that added identities should be subject to confirmation before
being used for authentication.
Confirmation is performed by the
.IR SSH_ASKPASS
program mentioned below.
Successful confirmation is signaled by a zero exit status from the
.IR SSH_ASKPASS
program, rather than text entered into the requester.
.TP
\fB\-D\fP
Deletes all identities from the agent.
.TP
\fB\-d\fP
Instead of adding identities, removes identities from the agent.
If
\fBssh-add\fP
has been run without arguments, the keys for the default identities will
be removed.
Otherwise, the argument list will be interpreted as a list of paths to
public key files and matching keys will be removed from the agent.
If no public key is found at a given path,
\fBssh-add\fP
will append
\fI\&.pub\fP
and retry.
.TP
\fB\-e\fP \fIreader\fP
Remove key in smartcard
\fIreader\fP.
.TP
\fB\-L\fP
Lists public key parameters of all identities currently represented
by the agent.
.TP
\fB\-l\fP
Lists fingerprints of all identities currently represented by the agent.
.TP
\fB\-s\fP \fIreader\fP
Add key in smartcard
\fIreader\fP.
.TP
\fB\-t\fP \fIlife\fP
Set a maximum lifetime when adding identities to an agent.
The lifetime may be specified in seconds or in a time format
specified in
\fBsshd_config\fP(5).
.TP
\fB\-X\fP
Unlock the agent.
.TP
\fB\-x\fP
Lock the agent with a password.
.SH ENVIRONMENT
.TP
.B "DISPLAY" and "SSH_ASKPASS"
If
\fBssh-add\fP
needs a passphrase, it will read the passphrase from the current
terminal if it was run from a terminal.
If
\fBssh-add\fP
does not have a terminal associated with it but
.IR DISPLAY
and
.IR SSH_ASKPASS
are set, it will execute the program specified by
.IR SSH_ASKPASS
and open an X11 window to read the passphrase.
This is particularly useful when calling
\fBssh-add\fP
from a
\fI\&.xsession\fP
or related script.
(Note that on some machines it
may be necessary to redirect the input from
\fI/dev/null\fP
to make this work.)
.TP
.B SSH_AUTH_SOCK
Identifies the path of a unix-domain socket used to communicate with the
agent.
.SH FILES
.TP
.B ~/.ssh/identity
Contains the protocol version 1 RSA authentication identity of the user.
.TP
.B ~/.ssh/id_dsa
Contains the protocol version 2 DSA authentication identity of the user.
.TP
.B ~/.ssh/id_rsa
Contains the protocol version 2 RSA authentication identity of the user.
Identity files should not be readable by anyone but the user.
Note that
\fBssh-add\fP
ignores identity files if they are accessible by others.
.SH DIAGNOSTICS
Exit status is 0 on success, 1 if the specified command fails,
and 2 if
\fBssh-add\fP
is unable to contact the authentication agent.
.SH SEE ALSO
\fBssh\fP(1),
\fBssh-agent\fP(1),
\fBssh-keygen\fP(1),
\fBsshd\fP(8)
.SH AUTHORS
OpenSSH is a derivative of the original and free
ssh 1.2.12 release by Tatu Ylonen.
Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
Theo de Raadt and Dug Song
removed many bugs, re-added newer features and
created OpenSSH.
Markus Friedl contributed the support for SSH
protocol versions 1.5 and 2.0.
.TH SSH-AGENT 1 "June 5 2007 " ""
.SH NAME
\fBssh-agent\fP
\- authentication agent
.SH SYNOPSIS
.br
\fBssh-agent\fP
[\fB\-a\fP \fIbind_address\fP]
[\fB\-c\fP | \fB\-s\fP]
[\fB\-t\fP \fIlife\fP]
[\fB\-d\fP]
[\fIcommand\fP [\fIargs\fP...]
.br
\fBssh-agent\fP
[\fB\-c\fP | \fB\-s\fP]
\fB\-k\fP
.SH DESCRIPTION
\fBssh-agent\fP
is a program to hold private keys used for public key authentication
(RSA, DSA).
The idea is that
\fBssh-agent\fP
is started in the beginning of an X-session or a login session, and
all other windows or programs are started as clients to the ssh-agent
program.
Through use of environment variables the agent can be located
and automatically used for authentication when logging in to other
machines using
\fBssh\fP(1).
The options are as follows:
.TP
\fB\-a\fP \fIbind_address\fP
Bind the agent to the unix-domain socket
\fIbind_address\fP.
The default is
\fI/tmp/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt\fP.
.TP
\fB\-c\fP
Generate C-shell commands on
.BR stdout .
This is the default if
.IR SHELL
looks like it's a csh style of shell.
.TP
\fB\-s\fP
Generate Bourne shell commands on
.BR stdout .
This is the default if
.IR SHELL
does not look like it's a csh style of shell.
.TP
\fB\-k\fP
Kill the current agent (given by the
.IR SSH_AGENT_PID
environment variable).
.TP
\fB\-t\fP \fIlife\fP
Set a default value for the maximum lifetime of identities added to the agent.
The lifetime may be specified in seconds or in a time format specified in
\fBsshd_config\fP(5).
A lifetime specified for an identity with
\fBssh-add\fP(1)
overrides this value.
Without this option the default maximum lifetime is forever.
.TP
\fB\-d\fP
Debug mode.
When this option is specified
\fBssh-agent\fP
will not fork.
If a commandline is given, this is executed as a subprocess of the agent.
When the command dies, so does the agent.
The agent initially does not have any private keys.
Keys are added using
\fBssh-add\fP(1).
When executed without arguments,
\fBssh-add\fP(1)
adds the files
\fI~/.ssh/id_rsa\fP,
\fI~/.ssh/id_dsa\fP
and
\fI~/.ssh/identity\fP.
If the identity has a passphrase,
\fBssh-add\fP(1)
asks for the passphrase (using a small X11 application if running
under X11, or from the terminal if running without X).
It then sends the identity to the agent.
Several identities can be stored in the
agent; the agent can automatically use any of these identities.
\fBssh-add -l\fP
displays the identities currently held by the agent.
The idea is that the agent is run in the user's local PC, laptop, or
terminal.
Authentication data need not be stored on any other
machine, and authentication passphrases never go over the network.
However, the connection to the agent is forwarded over SSH
remote logins, and the user can thus use the privileges given by the
identities anywhere in the network in a secure way.
There are two main ways to get an agent set up:
The first is that the agent starts a new subcommand into which some environment
variables are exported, eg
\fBssh-agent\fP xterm & .
The second is that the agent prints the needed shell commands (either
\fBsh\fP(1)
or
\fBcsh\fP(1)
syntax can be generated) which can be evalled in the calling shell, eg
\fBeval\fP `ssh-agent -s`
for Bourne-type shells such as
\fBsh\fP(1)
or
\fBksh\fP(1)
and
\fBeval\fP `ssh-agent -c`
for
\fBcsh\fP(1)
and derivatives.
Later
\fBssh\fP(1)
looks at these variables and uses them to establish a connection to the agent.
The agent will never send a private key over its request channel.
Instead, operations that require a private key will be performed
by the agent, and the result will be returned to the requester.
This way, private keys are not exposed to clients using the agent.
A unix-domain socket is created
and the name of this socket is stored in the
.IR SSH_AUTH_SOCK
environment
variable.
The socket is made accessible only to the current user.
This method is easily abused by root or another instance of the same
user.
The
.IR SSH_AGENT_PID
environment variable holds the agent's process ID.
The agent exits automatically when the command given on the command
line terminates.
.SH FILES
.TP
.B ~/.ssh/identity
Contains the protocol version 1 RSA authentication identity of the user.
.TP
.B ~/.ssh/id_dsa
Contains the protocol version 2 DSA authentication identity of the user.
.TP
.B ~/.ssh/id_rsa
Contains the protocol version 2 RSA authentication identity of the user.
.TP
.B /tmp/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt
Unix-domain sockets used to contain the connection to the
authentication agent.
These sockets should only be readable by the owner.
The sockets should get automatically removed when the agent exits.
.SH SEE ALSO
\fBssh\fP(1),
\fBssh-add\fP(1),
\fBssh-keygen\fP(1),
\fBsshd\fP(8)
.SH AUTHORS
OpenSSH is a derivative of the original and free
ssh 1.2.12 release by Tatu Ylonen.
Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
Theo de Raadt and Dug Song
removed many bugs, re-added newer features and
created OpenSSH.
Markus Friedl contributed the support for SSH
protocol versions 1.5 and 2.0.
.TH SSH-KEYGEN 1 "June 5 2007 " ""
.SH NAME
\fBssh-keygen\fP
\- authentication key generation, management and conversion
.SH SYNOPSIS
.br
\fBssh-keygen\fP
[\fB\-q\fP]
[\fB\-b\fP \fIbits\fP]
\fB\-t\fP \fItype\fP
[\fB\-N\fP \fInew_passphrase\fP]
[\fB\-C\fP \fIcomment\fP]
[\fB\-f\fP \fIoutput_keyfile\fP]
.br
\fBssh-keygen\fP
\fB\-p\fP
[\fB\-P\fP \fIold_passphrase\fP]
[\fB\-N\fP \fInew_passphrase\fP]
[\fB\-f\fP \fIkeyfile\fP]
.br
\fBssh-keygen\fP
\fB\-i\fP
[\fB\-f\fP \fIinput_keyfile\fP]
.br
\fBssh-keygen\fP
\fB\-e\fP
[\fB\-f\fP \fIinput_keyfile\fP]
.br
\fBssh-keygen\fP
\fB\-y\fP
[\fB\-f\fP \fIinput_keyfile\fP]
.br
\fBssh-keygen\fP
\fB\-c\fP
[\fB\-P\fP \fIpassphrase\fP]
[\fB\-C\fP \fIcomment\fP]
[\fB\-f\fP \fIkeyfile\fP]
.br
\fBssh-keygen\fP
\fB\-l\fP
[\fB\-f\fP \fIinput_keyfile\fP]
.br
\fBssh-keygen\fP
\fB\-B\fP
[\fB\-f\fP \fIinput_keyfile\fP]
.br
\fBssh-keygen\fP
\fB\-D\fP \fIreader\fP
.br
\fBssh-keygen\fP
\fB\-F\fP \fIhostname\fP
[\fB\-f\fP \fIknown_hosts_file\fP]
.br
\fBssh-keygen\fP
\fB\-H\fP
[\fB\-f\fP \fIknown_hosts_file\fP]
.br
\fBssh-keygen\fP
\fB\-R\fP \fIhostname\fP
[\fB\-f\fP \fIknown_hosts_file\fP]
.br
\fBssh-keygen\fP
\fB\-U\fP \fIreader\fP
[\fB\-f\fP \fIinput_keyfile\fP]
.br
\fBssh-keygen\fP
\fB\-r\fP \fIhostname\fP
[\fB\-f\fP \fIinput_keyfile\fP]
[\fB\-g\fP]
.br
\fBssh-keygen\fP
\fB\-G\fP \fIoutput_file\fP
[\fB\-v\fP]
[\fB\-b\fP \fIbits\fP]
[\fB\-M\fP \fImemory\fP]
[\fB\-S\fP \fIstart_point\fP]
.br
\fBssh-keygen\fP
\fB\-T\fP \fIoutput_file\fP
\fB\-f\fP \fIinput_file\fP
[\fB\-v\fP]
[\fB\-a\fP \fInum_trials\fP]
[\fB\-W\fP \fIgenerator\fP]
.SH DESCRIPTION
\fBssh-keygen\fP
generates, manages and converts authentication keys for
\fBssh\fP(1).
\fBssh-keygen\fP
can create RSA keys for use by SSH protocol version 1 and RSA or DSA
keys for use by SSH protocol version 2.
The type of key to be generated is specified with the
\fB\-t\fP
option.
If invoked without any arguments,
\fBssh-keygen\fP
will generate an RSA key for use in SSH protocol 2 connections.
\fBssh-keygen\fP
is also used to generate groups for use in Diffie-Hellman group
exchange (DH-GEX).
See the
.B MODULI GENERATION
section for details.
Normally each user wishing to use SSH
with RSA or DSA authentication runs this once to create the authentication
key in
\fI~/.ssh/identity\fP,
\fI~/.ssh/id_dsa\fP
or
\fI~/.ssh/id_rsa\fP.
Additionally, the system administrator may use this to generate host keys,
as seen in
\fI/etc/rc\fP.
Normally this program generates the key and asks for a file in which
to store the private key.
The public key is stored in a file with the same name but
``.pub''
appended.
The program also asks for a passphrase.
The passphrase may be empty to indicate no passphrase
(host keys must have an empty passphrase), or it may be a string of
arbitrary length.
A passphrase is similar to a password, except it can be a phrase with a
series of words, punctuation, numbers, whitespace, or any string of
characters you want.
Good passphrases are 10-30 characters long, are
not simple sentences or otherwise easily guessable (English
prose has only 1-2 bits of entropy per character, and provides very bad
passphrases), and contain a mix of upper and lowercase letters,
numbers, and non-alphanumeric characters.
The passphrase can be changed later by using the
\fB\-p\fP
option.
There is no way to recover a lost passphrase.
If the passphrase is
lost or forgotten, a new key must be generated and copied to the
corresponding public key to other machines.
For RSA1 keys,
there is also a comment field in the key file that is only for
convenience to the user to help identify the key.
The comment can tell what the key is for, or whatever is useful.
The comment is initialized to
``user@host''
when the key is created, but can be changed using the
\fB\-c\fP
option.
After a key is generated, instructions below detail where the keys
should be placed to be activated.
The options are as follows:
.TP
\fB\-a\fP \fItrials\fP
Specifies the number of primality tests to perform when screening DH-GEX
candidates using the
\fB\-T\fP
command.
.TP
\fB\-B\fP
Show the bubblebabble digest of specified private or public key file.
.TP
\fB\-b\fP \fIbits\fP
Specifies the number of bits in the key to create.
For RSA keys, the minimum size is 768 bits and the default is 2048 bits.
Generally, 2048 bits is considered sufficient.
DSA keys must be exactly 1024 bits as specified by FIPS 186-2.
.TP
\fB\-C\fP \fIcomment\fP
Provides a new comment.
.TP
\fB\-c\fP
Requests changing the comment in the private and public key files.
This operation is only supported for RSA1 keys.
The program will prompt for the file containing the private keys, for
the passphrase if the key has one, and for the new comment.
.TP
\fB\-D\fP \fIreader\fP
Download the RSA public key stored in the smartcard in
\fIreader\fP.
.TP
\fB\-e\fP
This option will read a private or public OpenSSH key file and
print the key in
RFC 4716 SSH Public Key File Format
to stdout.
This option allows exporting keys for use by several commercial
SSH implementations.
.TP
\fB\-F\fP \fIhostname\fP
Search for the specified
\fIhostname\fP
in a
\fIknown_hosts\fP
file, listing any occurrences found.
This option is useful to find hashed host names or addresses and may also be
used in conjunction with the
\fB\-H\fP
option to print found keys in a hashed format.
.TP
\fB\-f\fP \fIfilename\fP
Specifies the filename of the key file.
.TP
\fB\-G\fP \fIoutput_file\fP
Generate candidate primes for DH-GEX.
These primes must be screened for
safety (using the
\fB\-T\fP
option) before use.
.TP
\fB\-g\fP
Use generic DNS format when printing fingerprint resource records using the
\fB\-r\fP
command.
.TP
\fB\-H\fP
Hash a
\fIknown_hosts\fP
file.
This replaces all hostnames and addresses with hashed representations
within the specified file; the original content is moved to a file with
a .old suffix.
These hashes may be used normally by
\fBssh\fP
and
\fBsshd\fP,
but they do not reveal identifying information should the file's contents
be disclosed.
This option will not modify existing hashed hostnames and is therefore safe
to use on files that mix hashed and non-hashed names.
.TP
\fB\-i\fP
This option will read an unencrypted private (or public) key file
in SSH2-compatible format and print an OpenSSH compatible private
(or public) key to stdout.
\fBssh-keygen\fP
also reads the
RFC 4716 SSH Public Key File Format.
This option allows importing keys from several commercial
SSH implementations.
.TP
\fB\-l\fP
Show fingerprint of specified public key file.
Private RSA1 keys are also supported.
For RSA and DSA keys
\fBssh-keygen\fP
tries to find the matching public key file and prints its fingerprint.
.TP
\fB\-M\fP \fImemory\fP
Specify the amount of memory to use (in megabytes) when generating
candidate moduli for DH-GEX.
.TP
\fB\-N\fP \fInew_passphrase\fP
Provides the new passphrase.
.TP
\fB\-P\fP \fIpassphrase\fP
Provides the (old) passphrase.
.TP
\fB\-p\fP
Requests changing the passphrase of a private key file instead of
creating a new private key.
The program will prompt for the file
containing the private key, for the old passphrase, and twice for the
new passphrase.
.TP
\fB\-q\fP
Silence
\fBssh-keygen\fP.
Used by
\fI/etc/rc\fP
when creating a new key.
.TP
\fB\-R\fP \fIhostname\fP
Removes all keys belonging to
\fIhostname\fP
from a
\fIknown_hosts\fP
file.
This option is useful to delete hashed hosts (see the
\fB\-H\fP
option above).
.TP
\fB\-r\fP \fIhostname\fP
Print the SSHFP fingerprint resource record named
\fIhostname\fP
for the specified public key file.
.TP
\fB\-S\fP \fIstart\fP
Specify start point (in hex) when generating candidate moduli for DH-GEX.
.TP
\fB\-T\fP \fIoutput_file\fP
Test DH group exchange candidate primes (generated using the
\fB\-G\fP
option) for safety.
.TP
\fB\-t\fP \fItype\fP
Specifies the type of key to create.
The possible values are
``rsa1''
for protocol version 1 and
``rsa''
or
``dsa''
for protocol version 2.
.TP
\fB\-U\fP \fIreader\fP
Upload an existing RSA private key into the smartcard in
\fIreader\fP.
.TP
\fB\-v\fP
Verbose mode.
Causes
\fBssh-keygen\fP
to print debugging messages about its progress.
This is helpful for debugging moduli generation.
Multiple
\fB\-v\fP
options increase the verbosity.
The maximum is 3.
.TP
\fB\-W\fP \fIgenerator\fP
Specify desired generator when testing candidate moduli for DH-GEX.
.TP
\fB\-y\fP
This option will read a private
OpenSSH format file and print an OpenSSH public key to stdout.
.SH MODULI GENERATION
\fBssh-keygen\fP
may be used to generate groups for the Diffie-Hellman Group Exchange
(DH-GEX) protocol.
Generating these groups is a two-step process: first, candidate
primes are generated using a fast, but memory intensive process.
These candidate primes are then tested for suitability (a CPU-intensive
process).
Generation of primes is performed using the
\fB\-G\fP
option.
The desired length of the primes may be specified by the
\fB\-b\fP
option.
For example:
Dl # ssh-keygen -G moduli-2048.candidates -b 2048
By default, the search for primes begins at a random point in the
desired length range.
This may be overridden using the
\fB\-S\fP
option, which specifies a different start point (in hex).
Once a set of candidates have been generated, they must be tested for
suitability.
This may be performed using the
\fB\-T\fP
option.
In this mode
\fBssh-keygen\fP
will read candidates from standard input (or a file specified using the
\fB\-f\fP
option).
For example:
Dl # ssh-keygen -T moduli-2048 -f moduli-2048.candidates
By default, each candidate will be subjected to 100 primality tests.
This may be overridden using the
\fB\-a\fP
option.
The DH generator value will be chosen automatically for the
prime under consideration.
If a specific generator is desired, it may be requested using the
\fB\-W\fP
option.
Valid generator values are 2, 3, and 5.
Screened DH groups may be installed in
\fI/etc/moduli\fP.
It is important that this file contains moduli of a range of bit lengths and
that both ends of a connection share common moduli.
.SH FILES
.TP
.B ~/.ssh/identity
Contains the protocol version 1 RSA authentication identity of the user.
This file should not be readable by anyone but the user.
It is possible to
specify a passphrase when generating the key; that passphrase will be
used to encrypt the private part of this file using 3DES.
This file is not automatically accessed by
\fBssh-keygen\fP
but it is offered as the default file for the private key.
\fBssh\fP(1)
will read this file when a login attempt is made.
.TP
.B ~/.ssh/identity.pub
Contains the protocol version 1 RSA public key for authentication.
The contents of this file should be added to
\fI~/.ssh/authorized_keys\fP
on all machines
where the user wishes to log in using RSA authentication.
There is no need to keep the contents of this file secret.
.TP
.B ~/.ssh/id_dsa
Contains the protocol version 2 DSA authentication identity of the user.
This file should not be readable by anyone but the user.
It is possible to
specify a passphrase when generating the key; that passphrase will be
used to encrypt the private part of this file using 3DES.
This file is not automatically accessed by
\fBssh-keygen\fP
but it is offered as the default file for the private key.
\fBssh\fP(1)
will read this file when a login attempt is made.
.TP
.B ~/.ssh/id_dsa.pub
Contains the protocol version 2 DSA public key for authentication.
The contents of this file should be added to
\fI~/.ssh/authorized_keys\fP
on all machines
where the user wishes to log in using public key authentication.
There is no need to keep the contents of this file secret.
.TP
.B ~/.ssh/id_rsa
Contains the protocol version 2 RSA authentication identity of the user.
This file should not be readable by anyone but the user.
It is possible to
specify a passphrase when generating the key; that passphrase will be
used to encrypt the private part of this file using 3DES.
This file is not automatically accessed by
\fBssh-keygen\fP
but it is offered as the default file for the private key.
\fBssh\fP(1)
will read this file when a login attempt is made.
.TP
.B ~/.ssh/id_rsa.pub
Contains the protocol version 2 RSA public key for authentication.
The contents of this file should be added to
\fI~/.ssh/authorized_keys\fP
on all machines
where the user wishes to log in using public key authentication.
There is no need to keep the contents of this file secret.
.TP
.B /etc/moduli
Contains Diffie-Hellman groups used for DH-GEX.
The file format is described in
\fBmoduli\fP(5).
.SH SEE ALSO
\fBssh\fP(1),
\fBssh-add\fP(1),
\fBssh-agent\fP(1),
\fBmoduli\fP(5),
\fBsshd\fP(8)
\fIThe Secure Shell (SSH) Public Key File Format\fP, RFC 4716, 2006.
.SH AUTHORS
OpenSSH is a derivative of the original and free
ssh 1.2.12 release by Tatu Ylonen.
Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
Theo de Raadt and Dug Song
removed many bugs, re-added newer features and
created OpenSSH.
Markus Friedl contributed the support for SSH
protocol versions 1.5 and 2.0.
.TH SSH-KEYSCAN 1 "June 5 2007 " ""
.SH NAME
\fBssh-keyscan\fP
\- gather ssh public keys
.SH SYNOPSIS
.br
\fBssh-keyscan\fP
[\fB\-46Hv\fP]
[\fB\-f\fP \fIfile\fP]
[\fB\-p\fP \fIport\fP]
[\fB\-T\fP \fItimeout\fP]
[\fB\-t\fP \fItype\fP]
[\fIhost\fP | \fIaddrlist\fP namelist]
[\fI...\fP]
.SH DESCRIPTION
\fBssh-keyscan\fP
is a utility for gathering the public ssh host keys of a number of
hosts.
It was designed to aid in building and verifying
\fIssh_known_hosts\fP
files.
\fBssh-keyscan\fP
provides a minimal interface suitable for use by shell and perl
scripts.
\fBssh-keyscan\fP
uses non-blocking socket I/O to contact as many hosts as possible in
parallel, so it is very efficient.
The keys from a domain of 1,000
hosts can be collected in tens of seconds, even when some of those
hosts are down or do not run ssh.
For scanning, one does not need
login access to the machines that are being scanned, nor does the
scanning process involve any encryption.
The options are as follows:
.TP
\fB\-4\fP
Forces
\fBssh-keyscan\fP
to use IPv4 addresses only.
.TP
\fB\-6\fP
Forces
\fBssh-keyscan\fP
to use IPv6 addresses only.
.TP
\fB\-f\fP \fIfile\fP
Read hosts or
\fIaddrlist\fP namelist
pairs from this file, one per line.
If
\fI-\fP
is supplied instead of a filename,
\fBssh-keyscan\fP
will read hosts or
\fIaddrlist\fP namelist
pairs from the standard input.
.TP
\fB\-H\fP
Hash all hostnames and addresses in the output.
Hashed names may be used normally by
\fBssh\fP
and
\fBsshd\fP,
but they do not reveal identifying information should the file's contents
be disclosed.
.TP
\fB\-p\fP \fIport\fP
Port to connect to on the remote host.
.TP
\fB\-T\fP \fItimeout\fP
Set the timeout for connection attempts.
If
\fItimeout\fP
seconds have elapsed since a connection was initiated to a host or since the
last time anything was read from that host, then the connection is
closed and the host in question considered unavailable.
Default is 5 seconds.
.TP
\fB\-t\fP \fItype\fP
Specifies the type of the key to fetch from the scanned hosts.
The possible values are
``rsa1''
for protocol version 1 and
``rsa''
or
``dsa''
for protocol version 2.
Multiple values may be specified by separating them with commas.
The default is
``rsa1''.
.TP
\fB\-v\fP
Verbose mode.
Causes
\fBssh-keyscan\fP
to print debugging messages about its progress.
.SH SECURITY
If an ssh_known_hosts file is constructed using
\fBssh-keyscan\fP
without verifying the keys, users will be vulnerable to
.IR man in the middle
attacks.
On the other hand, if the security model allows such a risk,
\fBssh-keyscan\fP
can help in the detection of tampered keyfiles or man in the middle
attacks which have begun after the ssh_known_hosts file was created.
.SH FILES
\fIInput\fP format:
1.2.3.4,1.2.4.4 name.my.domain,name,n.my.domain,n,1.2.3.4,1.2.4.4
.br
\fIOutput\fP format for rsa1 keys:
host-or-namelist bits exponent modulus
.br
\fIOutput\fP format for rsa and dsa keys:
host-or-namelist keytype base64-encoded-key
.br
Where
\fIkeytype\fP
is either
``ssh-rsa''
or
``ssh-dss''.
\fI/etc/ssh/ssh_known_hosts\fP
.SH EXAMPLES
Print the
\fIrsa1\fP
host key for machine
\fIhostname\fP:
$ ssh-keyscan hostname
.br
Find all hosts from the file
\fIssh_hosts\fP
which have new or different keys from those in the sorted file
\fIssh_known_hosts\fP:
$ ssh-keyscan -t rsa,dsa -f ssh_hosts | \e
.br
sort -u - ssh_known_hosts | diff ssh_known_hosts -
.br
.SH SEE ALSO
\fBssh\fP(1),
\fBsshd\fP(8)
.SH AUTHORS
-nosplit
David Mazieres <[email protected]>
wrote the initial version, and
Wayne Davison <[email protected]>
added support for protocol version 2.
.SH BUGS
It generates "Connection closed by remote host" messages on the consoles
of all the machines it scans if the server is older than version 2.9.
This is because it opens a connection to the ssh port, reads the public
key, and drops the connection as soon as it gets the key.
.TH SSH-KEYSIGN 8 "June 5 2007 " ""
.SH NAME
\fBssh-keysign\fP
\- ssh helper program for host-based authentication
.SH SYNOPSIS
.br
\fBssh-keysign\fP
.SH DESCRIPTION
\fBssh-keysign\fP
is used by
\fBssh\fP(1)
to access the local host keys and generate the digital signature
required during host-based authentication with SSH protocol version 2.
\fBssh-keysign\fP
is disabled by default and can only be enabled in the
global client configuration file
\fI/etc/ssh/ssh_config\fP
by setting
\fBEnableSSHKeysign\fP
to
``yes''.
\fBssh-keysign\fP
is not intended to be invoked by the user, but from
\fBssh\fP(1).
See
\fBssh\fP(1)
and
\fBsshd\fP(8)
for more information about host-based authentication.
.SH FILES
.TP
.B /etc/ssh/ssh_config
Controls whether
\fBssh-keysign\fP
is enabled.
.TP
.B /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_key
These files contain the private parts of the host keys used to
generate the digital signature.
They should be owned by root, readable only by root, and not
accessible to others.
Since they are readable only by root,
\fBssh-keysign\fP
must be set-uid root if host-based authentication is used.
.SH SEE ALSO
\fBssh\fP(1),
\fBssh-keygen\fP(1),
\fBssh_config\fP(5),
\fBsshd\fP(8)
.SH HISTORY
\fBssh-keysign\fP
first appeared in
OpenBSD 3.2 .
.SH AUTHORS
Markus Friedl <[email protected]>
.TH SSH-RAND-HELPER 8 "April 14, 2002" ""
.SH NAME
\fBssh-rand-helper\fP
\- random number gatherer for OpenSSH
.SH SYNOPSIS
.br
\fBssh-rand-hlper\fP
[\fB\-vxXh\fP]
[\fB\-b\fP \fIbytes\fP]
.SH DESCRIPTION
\fBssh-rand-helper\fP
is a small helper program used by
\fBssh\fP(1),
\fBssh-add\fP(1),
\fBssh-agent\fP(1),
\fBssh-keygen\fP(1),
\fBssh-keyscan\fP(1)
and
\fBsshd\fP(8)
to gather random numbers of cryptographic quality if the
\fBopenssl\fP(4)
library has not been configured to provide them itself.
Normally
\fBssh-rand-helper\fP
will generate a strong random seed and provide it to the calling
program via standard output. If standard output is a tty,
\fBssh-rand-helper\fP
will instead print the seed in hexidecimal format unless told otherwise.
\fBssh-rand-helper\fP
will by default gather random numbers from the system commands listed
in
\fI/etc/ssh/ssh_prng_cmds\fP.
The output of each of the commands listed will be hashed and used to
generate a random seed for the calling program.
\fBssh-rand-helper\fP
will also store seed files in
\fI~/.ssh/prng_seed\fP
between executions.
Alternately,
\fBssh-rand-helper\fP
may be configured at build time to collect random numbers from a
EGD/PRNGd server via a unix domain or localhost tcp socket.
This program is not intended to be run by the end-user, so the few
commandline options are for debugging purposes only.
.TP
\fB\-b\fP \fIbytes\fP
Specify the number of random bytes to include in the output.
.TP
\fB\-x\fP
Output a hexidecimal instead of a binary seed.
.TP
\fB\-X\fP
Force output of a binary seed, even if standard output is a tty
.TP
\fB\-v\fP
Turn on debugging message. Multiple
\fB\-v\fP
options will increase the debugging level.
.TP
\fB\-h\fP
Display a summary of options.
.SH AUTHORS
Damien Miller <[email protected]>
.SH SEE ALSO
\fBssh\fP(1),
\fBssh-add\fP(1),
\fBssh-keygen\fP(1),
\fBsshd\fP(8)
.TH SSHD 8 "August 16 2007 " ""
.SH NAME
\fBsshd\fP
\- OpenSSH SSH daemon
.SH SYNOPSIS
.br
\fBsshd\fP
[\fB\-46Ddeiqt\fP]
[\fB\-b\fP \fIbits\fP]
[\fB\-f\fP \fIconfig_file\fP]
[\fB\-g\fP \fIlogin_grace_time\fP]
[\fB\-h\fP \fIhost_key_file\fP]
[\fB\-k\fP \fIkey_gen_time\fP]
[\fB\-o\fP \fIoption\fP]
[\fB\-p\fP \fIport\fP]
[\fB\-u\fP \fIlen\fP]
.SH DESCRIPTION
\fBsshd\fP
(OpenSSH Daemon) is the daemon program for
\fBssh\fP(1).
Together these programs replace
\fBrlogin\fP(1)
and
\fBrsh\fP(1),
and provide secure encrypted communications between two untrusted hosts
over an insecure network.
\fBsshd\fP
listens for connections from clients.
It is normally started at boot from
\fI/etc/rc\fP.
It forks a new
daemon for each incoming connection.
The forked daemons handle
key exchange, encryption, authentication, command execution,
and data exchange.
\fBsshd\fP
can be configured using command-line options or a configuration file
(by default
\fBsshd_config\fP(5)) ;
command-line options override values specified in the
configuration file.
\fBsshd\fP
rereads its configuration file when it receives a hangup signal,
.BR SIGHUP ,
by executing itself with the name and options it was started with, e.g.\&
\fI/usr/sbin/sshd\fP.
The options are as follows:
.TP
\fB\-4\fP
Forces
\fBsshd\fP
to use IPv4 addresses only.
.TP
\fB\-6\fP
Forces
\fBsshd\fP
to use IPv6 addresses only.
.TP
\fB\-b\fP \fIbits\fP
Specifies the number of bits in the ephemeral protocol version 1
server key (default 768).
.TP
\fB\-D\fP
When this option is specified,
\fBsshd\fP
will not detach and does not become a daemon.
This allows easy monitoring of
\fBsshd\fP.
.TP
\fB\-d\fP
Debug mode.
The server sends verbose debug output to the system
log, and does not put itself in the background.
The server also will not fork and will only process one connection.
This option is only intended for debugging for the server.
Multiple
\fB\-d\fP
options increase the debugging level.
Maximum is 3.
.TP
\fB\-e\fP
When this option is specified,
\fBsshd\fP
will send the output to the standard error instead of the system log.
.TP
\fB\-f\fP \fIconfig_file\fP
Specifies the name of the configuration file.
The default is
\fI/etc/ssh/sshd_config\fP.
\fBsshd\fP
refuses to start if there is no configuration file.
.TP
\fB\-g\fP \fIlogin_grace_time\fP
Gives the grace time for clients to authenticate themselves (default
120 seconds).
If the client fails to authenticate the user within
this many seconds, the server disconnects and exits.
A value of zero indicates no limit.
.TP
\fB\-h\fP \fIhost_key_file\fP
Specifies a file from which a host key is read.
This option must be given if
\fBsshd\fP
is not run as root (as the normal
host key files are normally not readable by anyone but root).
The default is
\fI/etc/ssh/ssh_host_key\fP
for protocol version 1, and
\fI/etc/ssh/ssh_host_rsa_key\fP
and
\fI/etc/ssh/ssh_host_dsa_key\fP
for protocol version 2.
It is possible to have multiple host key files for
the different protocol versions and host key algorithms.
.TP
\fB\-i\fP
Specifies that
\fBsshd\fP
is being run from
\fBinetd\fP(8).
\fBsshd\fP
is normally not run
from inetd because it needs to generate the server key before it can
respond to the client, and this may take tens of seconds.
Clients would have to wait too long if the key was regenerated every time.
However, with small key sizes (e.g. 512) using
\fBsshd\fP
from inetd may
be feasible.
.TP
\fB\-k\fP \fIkey_gen_time\fP
Specifies how often the ephemeral protocol version 1 server key is
regenerated (default 3600 seconds, or one hour).
The motivation for regenerating the key fairly
often is that the key is not stored anywhere, and after about an hour
it becomes impossible to recover the key for decrypting intercepted
communications even if the machine is cracked into or physically
seized.
A value of zero indicates that the key will never be regenerated.
.TP
\fB\-o\fP \fIoption\fP
Can be used to give options in the format used in the configuration file.
This is useful for specifying options for which there is no separate
command-line flag.
For full details of the options, and their values, see
\fBsshd_config\fP(5).
.TP
\fB\-p\fP \fIport\fP
Specifies the port on which the server listens for connections
(default 22).
Multiple port options are permitted.
Ports specified in the configuration file with the
\fBPort\fP
option are ignored when a command-line port is specified.
Ports specified using the
\fBListenAddress\fP
option override command-line ports.
.TP
\fB\-q\fP
Quiet mode.
Nothing is sent to the system log.
Normally the beginning,
authentication, and termination of each connection is logged.
.TP
\fB\-t\fP
Test mode.
Only check the validity of the configuration file and sanity of the keys.
This is useful for updating
\fBsshd\fP
reliably as configuration options may change.
.TP
\fB\-u\fP \fIlen\fP
This option is used to specify the size of the field
in the
utmp
structure that holds the remote host name.
If the resolved host name is longer than
\fIlen\fP,
the dotted decimal value will be used instead.
This allows hosts with very long host names that
overflow this field to still be uniquely identified.
Specifying
\fB\-u0\fP
indicates that only dotted decimal addresses
should be put into the
\fIutmp\fP
file.
\fB\-u0\fP
may also be used to prevent
\fBsshd\fP
from making DNS requests unless the authentication
mechanism or configuration requires it.
Authentication mechanisms that may require DNS include
\fBRhostsRSAAuthentication\fP,
\fBHostbasedAuthentication\fP,
and using a
\fBfrom="pattern-list"\fP
option in a key file.
Configuration options that require DNS include using a
USER@HOST pattern in
\fBAllowUsers\fP
or
\fBDenyUsers\fP.
.SH AUTHENTICATION
The OpenSSH SSH daemon supports SSH protocols 1 and 2.
Both protocols are supported by default,
though this can be changed via the
\fBProtocol\fP
option in
\fBsshd_config\fP(5).
Protocol 2 supports both RSA and DSA keys;
protocol 1 only supports RSA keys.
For both protocols,
each host has a host-specific key,
normally 2048 bits,
used to identify the host.
Forward security for protocol 1 is provided through
an additional server key,
normally 768 bits,
generated when the server starts.
This key is normally regenerated every hour if it has been used, and
is never stored on disk.
Whenever a client connects, the daemon responds with its public
host and server keys.
The client compares the
RSA host key against its own database to verify that it has not changed.
The client then generates a 256-bit random number.
It encrypts this
random number using both the host key and the server key, and sends
the encrypted number to the server.
Both sides then use this
random number as a session key which is used to encrypt all further
communications in the session.
The rest of the session is encrypted
using a conventional cipher, currently Blowfish or 3DES, with 3DES
being used by default.
The client selects the encryption algorithm
to use from those offered by the server.
For protocol 2,
forward security is provided through a Diffie-Hellman key agreement.
This key agreement results in a shared session key.
The rest of the session is encrypted using a symmetric cipher, currently
128-bit AES, Blowfish, 3DES, CAST128, Arcfour, 192-bit AES, or 256-bit AES.
The client selects the encryption algorithm
to use from those offered by the server.
Additionally, session integrity is provided
through a cryptographic message authentication code
(hmac-md5, hmac-sha1, umac-64 or hmac-ripemd160).
Finally, the server and the client enter an authentication dialog.
The client tries to authenticate itself using
host-based authentication,
public key authentication,
challenge-response authentication,
or password authentication.
Regardless of the authentication type, the account is checked to
ensure that it is accessible. An account is not accessible if it is
locked, listed in
\fBDenyUsers\fP
or its group is listed in
\fBDenyGroups\fP
\&. The definition of a locked account is system dependant. Some platforms
have their own account database (eg AIX) and some modify the passwd field (
`\&*LK\&*'
on Solaris and UnixWare,
`\&*'
on HP-UX, containing
`Nologin'
on Tru64,
a leading
`\&*LOCKED\&*'
on FreeBSD and a leading
`\&!'
on most Linuxes).
If there is a requirement to disable password authentication
for the account while allowing still public-key, then the passwd field
should be set to something other than these values (eg
`NP'
or
`\&*NP\&*'
).
If the client successfully authenticates itself, a dialog for
preparing the session is entered.
At this time the client may request
things like allocating a pseudo-tty, forwarding X11 connections,
forwarding TCP connections, or forwarding the authentication agent
connection over the secure channel.
After this, 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.
.SH LOGIN PROCESS
When a user successfully logs in,
\fBsshd\fP
does the following:
.IP 1.
If the login is on a tty, and no command has been specified,
prints last login time and
\fI/etc/motd\fP
(unless prevented in the configuration file or by
\fI~/.hushlogin\fP;
see the
.B FILES
section).
.IP 2.
If the login is on a tty, records login time.
.IP 3.
Checks
\fI/etc/nologin\fP;
if it exists, prints contents and quits
(unless root).
.IP 4.
Changes to run with normal user privileges.
.IP 5.
Sets up basic environment.
.IP 6.
Reads the file
\fI~/.ssh/environment\fP,
if it exists, and users are allowed to change their environment.
See the
\fBPermitUserEnvironment\fP
option in
\fBsshd_config\fP(5).
.IP 7.
Changes to user's home directory.
.IP 8.
If
\fI~/.ssh/rc\fP
exists, runs it; else if
\fI/etc/ssh/sshrc\fP
exists, runs
it; otherwise runs xauth.
The
``rc''
files are given the X11
authentication protocol and cookie in standard input.
See
.B SSHRC ,
below.
.IP 9.
Runs user's shell or command.
.SH SSHRC
If the file
\fI~/.ssh/rc\fP
exists,
\fBsh\fP(1)
runs it after reading the
environment files but before starting the user's shell or command.
It must not produce any output on stdout; stderr must be used
instead.
If X11 forwarding is in use, it will receive the "proto cookie" pair in
its standard input (and
.IR DISPLAY
in its environment).
The script must call
\fBxauth\fP(1)
because
\fBsshd\fP
will not run xauth automatically to add X11 cookies.
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 read proto cookie && [ -n "$DISPLAY" ]; then
.br
if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
.br
# X11UseLocalhost=yes
.br
echo add unix:`echo $DISPLAY |
.br
cut -c11-` $proto $cookie
.br
else
.br
# X11UseLocalhost=no
.br
echo add $DISPLAY $proto $cookie
.br
fi | xauth -q -
.br
fi
.br
If this file does not exist,
\fI/etc/ssh/sshrc\fP
is run, and if that
does not exist either, xauth is used to add the cookie.
.SH AUTHORIZED_KEYS FILE FORMAT
\fBAuthorizedKeysFile\fP
specifies the file containing public keys for
public key authentication;
if none is specified, the default is
\fI~/.ssh/authorized_keys\fP.
Each line of the file contains one
key (empty lines and lines starting with a
`#'
are ignored as
comments).
Protocol 1 public keys consist of the following space-separated fields:
options, bits, exponent, modulus, comment.
Protocol 2 public key consist of:
options, keytype, base64-encoded key, comment.
The options field is optional;
its presence is determined by whether the line starts
with a number or not (the options field never starts with a number).
The bits, exponent, modulus, and comment fields give the RSA key for
protocol version 1; the
comment field is not used for anything (but may be convenient for the
user to identify the key).
For protocol version 2 the keytype is
``ssh-dss''
or
``ssh-rsa''.
Note that lines in this file are usually several hundred bytes long
(because of the size of the public key encoding) up to a limit of
8 kilobytes, which permits DSA keys up to 8 kilobits and RSA
keys up to 16 kilobits.
You don't want to type them in; instead, copy the
\fIidentity.pub\fP,
\fIid_dsa.pub\fP,
or the
\fIid_rsa.pub\fP
file and edit it.
\fBsshd\fP
enforces a minimum RSA key modulus size for protocol 1
and protocol 2 keys of 768 bits.
The options (if present) consist of comma-separated option
specifications.
No spaces are permitted, except within double quotes.
The following option specifications are supported (note
that option keywords are case-insensitive):
.TP
\fBcommand="command"\fP
Specifies that the command is executed whenever this key is used for
authentication.
The command supplied by the user (if any) is ignored.
The command is run on a pty if the client requests a pty;
otherwise it is run without a tty.
If an 8-bit clean channel is required,
one must not request a pty or should specify
\fBno-pty\fP.
A quote may be included in the command by quoting it with a backslash.
This option might be useful
to restrict certain public keys to perform just a specific operation.
An example might be a key that permits remote backups but nothing else.
Note that the client may specify TCP and/or X11
forwarding unless they are explicitly prohibited.
The command originally supplied by the client is available in the
.IR SSH_ORIGINAL_COMMAND
environment variable.
Note that this option applies to shell, command or subsystem execution.
.TP
\fBenvironment="NAME=value"\fP
Specifies that the string is to be added to the environment when
logging in using this key.
Environment variables set this way
override other default environment values.
Multiple options of this type are permitted.
Environment processing is disabled by default and is
controlled via the
\fBPermitUserEnvironment\fP
option.
This option is automatically disabled if
\fBUseLogin\fP
is enabled.
.TP
\fBfrom="pattern-list"\fP
Specifies that in addition to public key authentication, the canonical name
of the remote host must be present in the comma-separated list of
patterns.
The purpose
of this option is to optionally increase security: public key authentication
by itself does not trust the network or name servers or anything (but
the key); however, if somebody somehow steals the key, the key
permits an intruder to log in from anywhere in the world.
This additional option makes using a stolen key more difficult (name
servers and/or routers would have to be compromised in addition to
just the key).
See
.B PATTERNS
in
\fBssh_config\fP(5)
for more information on patterns.
.TP
\fBno-agent-forwarding\fP
Forbids authentication agent forwarding when this key is used for
authentication.
.TP
\fBno-port-forwarding\fP
Forbids TCP forwarding when this key is used for authentication.
Any port forward requests by the client will return an error.
This might be used, e.g. in connection with the
\fBcommand\fP
option.
.TP
\fBno-pty\fP
Prevents tty allocation (a request to allocate a pty will fail).
.TP
\fBno-X11-forwarding\fP
Forbids X11 forwarding when this key is used for authentication.
Any X11 forward requests by the client will return an error.
.TP
\fBpermitopen="host:port"\fP
Limit local
``ssh -L''
port forwarding such that it may only connect to the specified host and
port.
IPv6 addresses can be specified with an alternative syntax:
\fIhost\fP/\fIport\fP.
Multiple
\fBpermitopen\fP
options may be applied separated by commas.
No pattern matching is performed on the specified hostnames,
they must be literal domains or addresses.
.TP
\fBtunnel="n"\fP
Force a
\fBtun\fP(4)
device on the server.
Without this option, the next available device will be used if
the client requests a tunnel.
An example authorized_keys file:
# Comments allowed at start of line
.br
ssh-rsa AAAAB3Nza...LiPk== [email protected]
.br
from="*.sales.example.net,!pc.sales.example.net" ssh-rsa
.br
AAAAB2...19Q== [email protected]
.br
command="dump /home",no-pty,no-port-forwarding ssh-dss
.br
AAAAC3...51R== example.net
.br
permitopen="192.0.2.1:80",permitopen="192.0.2.2:25" ssh-dss
.br
AAAAB5...21S==
.br
tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...==
.br
[email protected]
.br
.SH SSH_KNOWN_HOSTS FILE FORMAT
The
\fI/etc/ssh/ssh_known_hosts\fP
and
\fI~/.ssh/known_hosts\fP
files 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 in these files contains the following fields: hostnames,
bits, exponent, modulus, comment.
The fields are separated by spaces.
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.
A hostname or address may optionally be enclosed within
`\&['
and
`\&]'
brackets then followed by
`\&:'
and a non-standard port number.
Alternately, hostnames may be stored in a hashed form which hides host names
and addresses should the file's contents be disclosed.
Hashed hostnames start with a
`|'
character.
Only one hashed hostname may appear on a single line and none of the above
negation or wildcard operators may be applied.
Bits, exponent, and modulus are taken directly from the RSA host key; they
can be obtained, for example, from
\fI/etc/ssh/ssh_host_key.pub\fP.
The optional comment field continues to the end of the line, and is not used.
Lines starting with
`#'
and empty lines are ignored as comments.
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.
This will inevitably happen when short forms of host names
from different domains are put in the file.
It is possible
that the files contain conflicting information; authentication is
accepted if valid information can be found from either file.
Note that the lines in these files are typically hundreds of characters
long, and you definitely don't want to type in the host keys by hand.
Rather, generate them by a script
or by taking
\fI/etc/ssh/ssh_host_key.pub\fP
and adding the host names at the front.
An example ssh_known_hosts file:
# Comments allowed at start of line
.br
closenet,...,192.0.2.53 1024 37 159...93 closenet.example.net
.br
cvs.example.net,192.0.2.10 ssh-rsa AAAA1234.....=
.br
# A hashed hostname
.br
|1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa
.br
AAAA1234.....=
.br
.SH FILES
.TP
~/.hushlogin
This file is used to suppress printing the last login time and
\fI/etc/motd\fP,
if
\fBPrintLastLog\fP
and
\fBPrintMotd\fP,
respectively,
are enabled.
It does not suppress printing of the banner specified by
\fBBanner\fP.
.TP
~/.rhosts
This file is used for host-based authentication (see
\fBssh\fP(1)
for more information).
On some machines this file may need to be
world-readable if the user's home directory is on an NFS partition,
because
\fBsshd\fP
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.
.TP
~/.shosts
This file is used in exactly the same way as
\fI\&.rhosts\fP,
but allows host-based authentication without permitting login with
rlogin/rsh.
.TP
~/.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 above.
The content of the file is not highly sensitive, but the recommended
permissions are read/write for the user, and not accessible by others.
If this file, the
\fI~/.ssh\fP
directory, or the user's home directory are writable
by other users, then the file could be modified or replaced by unauthorized
users.
In this case,
\fBsshd\fP
will not allow it to be used unless the
\fBStrictModes\fP
option has been set to
``no''.
The recommended permissions can be set by executing
``chmod go-w ~/ ~/.ssh ~/.ssh/authorized_keys''.
.TP
~/.ssh/environment
This file is read into the environment at login (if it exists).
It can only contain empty lines, comment lines (that start with
`#' ) ,
and assignment lines of the form name=value.
The file should be writable
only by the user; it need not be readable by anyone else.
Environment processing is disabled by default and is
controlled via the
\fBPermitUserEnvironment\fP
option.
.TP
~/.ssh/known_hosts
Contains a list of host keys for all hosts the user has logged into
that are not already in the systemwide list of known host keys.
The format of this file is described above.
This file should be writable only by root/the owner and
can, but need not be, world-readable.
.TP
~/.ssh/rc
Contains initialization routines to be run before
the user's home directory becomes accessible.
This file should be writable only by the user, and need not be
readable by anyone else.
.TP
/etc/hosts.allow
.TP
/etc/hosts.deny
Access controls that should be enforced by tcp-wrappers are defined here.
Further details are described in
\fBhosts_access\fP(5).
.TP
/etc/hosts.equiv
This file is for host-based authentication (see
\fBssh\fP(1)) .
It should only be writable by root.
.TP
/etc/moduli
Contains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange".
The file format is described in
\fBmoduli\fP(5).
.TP
/etc/motd
See
\fBmotd\fP(5).
.TP
/etc/nologin
If this file exists,
\fBsshd\fP
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.
The file should be world-readable.
.TP
/etc/shosts.equiv
This file is used in exactly the same way as
\fIhosts.equiv\fP,
but allows host-based authentication without permitting login with
rlogin/rsh.
.TP
/etc/ssh/ssh_host_key
.TP
/etc/ssh/ssh_host_dsa_key
.TP
/etc/ssh/ssh_host_rsa_key
These three files contain the private parts of the host keys.
These files should only be owned by root, readable only by root, and not
accessible to others.
Note that
\fBsshd\fP
does not start if these files are group/world-accessible.
.TP
/etc/ssh/ssh_host_key.pub
.TP
/etc/ssh/ssh_host_dsa_key.pub
.TP
/etc/ssh/ssh_host_rsa_key.pub
These three files contain the public parts of the host keys.
These files should be world-readable but writable only by
root.
Their contents should match the respective private parts.
These files are not
really used for anything; they are provided for the convenience of
the user so their contents can be copied to known hosts files.
These files are created using
\fBssh-keygen\fP(1).
.TP
/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.
The format of this file is described above.
This file should be writable only by root/the owner and
should be world-readable.
.TP
/etc/ssh/sshd_config
Contains configuration data for
\fBsshd\fP.
The file format and configuration options are described in
\fBsshd_config\fP(5).
.TP
/etc/ssh/sshrc
Similar to
\fI~/.ssh/rc\fP,
it can be used to specify
machine-specific login-time initializations globally.
This file should be writable only by root, and should be world-readable.
.TP
/var/empty
\fBchroot\fP(2)
directory used by
\fBsshd\fP
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.
.TP
/var/run/sshd.pid
Contains the process ID of the
\fBsshd\fP
listening for connections (if there are several daemons running
concurrently for different ports, this contains the process ID of the one
started last).
The content of this file is not sensitive; it can be world-readable.
.SH SEE ALSO
\fBscp\fP(1),
\fBsftp\fP(1),
\fBssh\fP(1),
\fBssh-add\fP(1),
\fBssh-agent\fP(1),
\fBssh-keygen\fP(1),
\fBssh-keyscan\fP(1),
\fBchroot\fP(2),
\fBhosts_access\fP(5),
\fBlogin.conf\fP(5),
\fBmoduli\fP(5),
\fBsshd_config\fP(5),
\fBinetd\fP(8),
\fBsftp-server\fP(8)
.SH AUTHORS
OpenSSH is a derivative of the original and free
ssh 1.2.12 release by Tatu Ylonen.
Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
Theo de Raadt and Dug Song
removed many bugs, re-added newer features and
created OpenSSH.
Markus Friedl contributed the support for SSH
protocol versions 1.5 and 2.0.
Niels Provos and Markus Friedl contributed support
for privilege separation.
.SH CAVEATS
System security is not improved unless
\fBrshd\fP,
\fBrlogind\fP,
and
\fBrexecd\fP
are disabled (thus completely disabling
\fBrlogin\fP()
and
\fBrsh\fP()
into the machine).
.TH SFTP-SERVER 8 "June 5 2007 " ""
.SH NAME
\fBsftp-server\fP
\- SFTP server subsystem
.SH SYNOPSIS
.br
\fBsftp-server\fP
[\fB\-f\fP \fIlog_facility\fP]
[\fB\-l\fP \fIlog_level\fP]
.SH DESCRIPTION
\fBsftp-server\fP
is a program that speaks the server side of SFTP protocol
to stdout and expects client requests from stdin.
\fBsftp-server\fP
is not intended to be called directly, but from
\fBsshd\fP(8)
using the
\fBSubsystem\fP
option.
Command-line flags to
\fBsftp-server\fP
should be specified in the
\fBSubsystem\fP
declaration.
See
\fBsshd_config\fP(5)
for more information.
Valid options are:
.TP
\fB\-f\fP \fIlog_facility\fP
Specifies the facility code that is used when logging messages from
\fB.\fP
The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
The default is AUTH.
.TP
\fB\-l\fP \fIlog_level\fP
Specifies which messages will be logged by
\fB.\fP
The possible values are:
QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
INFO and VERBOSE log transactions that
\fBsftp-server\fP
performs on behalf of the client.
DEBUG and DEBUG1 are equivalent.
DEBUG2 and DEBUG3 each specify higher levels of debugging output.
The default is ERROR.
.SH SEE ALSO
\fBsftp\fP(1),
\fBssh\fP(1),
\fBsshd_config\fP(5),
\fBsshd\fP(8)
S. Lehtinen and T. Ylonen, \fISSH File Transfer Protocol\fP, draft-ietf-secsh-filexfer-00.txt, January 2001, work in progress material.
.SH HISTORY
\fBsftp-server\fP
first appeared in
OpenBSD 2.8 .
.SH AUTHORS
Markus Friedl <[email protected]>
|