Options

-4
Forces ssh to use IPv4 addresses only. If both -4 and -6 are specified, ssh uses the option that appears last on the command line.
-6
Forces ssh to use IPv6 addresses only. If both -4 and -6 are specified, ssh uses the option that appears last on the command line.
-a
Disables forwarding of the authentication agent connection.
-A
Enables forwarding of the authentication agent connection. This can also be specified on a per-host basis in a ssh_config configuration file.

Enable agent forwarding 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. Attackers 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.

Restriction: This option is not supported if running in FIPS mode.
-b bind_address
Use bind_address on the local machine as the source address of the connection. This option is useful only on systems with more than one address.

The bind_address must be the same address family (IPv4 or IPv6) as the remote host name specified on the ssh command line.

-c cipher_spec
Selects the cipher to use for encrypting the session.

Start of change Ciphers can be specified in order of preference in a comma-separated list. For a list of valid ciphers, see Ciphers. End of change

The cipher is typically one long unbroken line; in the following example the cipher is not shown as one unbroken line due to space limitations. See the ciphers keyword in ssh_config for default list.

The ciphers list might need to be modified based on the ciphers source used. For more information, see the CiphersSource keyword in the z/OS-specific OpenSSH client configuration files zos_ssh_config or zos_user_ssh_config.

-C
Requests compression of all data (including stdin, stdout, stderr, and data for forwarded X11 and TCP connections). The default value can be set on a per-host basis in the ssh_config configuration file; for more information about the Compression and CompressionLevel options, see ssh_config.
-D [bind_address:]port
Specifies a local dynamic application-level port forwarding. This type of dynamic port forwarding works by allocating a socket to listen to port on the local side, optionally bound to the specified bind_address. Whenever a connection is made to this port, it is forwarded over the secure channel and the application protocol is used to determine where to connect from the remote machine. Currently, the SOCKS4 and SOCKS5 protocol are supported and ssh will act as a SOCKS server. Only a superuser can forward privileged ports. Dynamic port forwardings can also be specified in the ssh_config configuration file.

IPv6 addresses can be specified with an alternative syntax: [bind_address/]port 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 GatewayPorts setting. However, an explicit bind_address can be used to bind the connection to a specific address. The bind_address of "localhost" indicates that the listening port is to be bound for local use only, while an empty address or '*' indicates that the port should be available from all interfaces.

OpenSSH - port forwarding examples has examples of port forwarding.

-E log_file
Append debug logs to log_file instead of standard error.
-e escape_char
Sets the escape character for sessions with a pty (the default is " ~"). 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 escape characters and makes the session fully transparent.
-f
Requests ssh to go to the background before command execution. This is useful if ssh is going to ask for passwords, password phrases, or passphrases, but the user wants it in the background. This implies -n. The recommended way to start X11 programs at a remote site is ssh -f host xterm.

If the ExitOnForwardFailure configuration option is set to "yes", then a client started with -f will wait for all remote port forwards to be successfully established before placing itself in the background.

Restriction: This option is not supported if running in FIPS mode, or Key Exchange algorithms are implemented using ICSF.

-F configfile
Specifies an alternative per-user ssh_config configuration file. If an ssh_config configuration file is given on the command line, the system-wide ssh_config configuration file (/etc/ssh/ssh_config) will be ignored. The default for the per-user ssh_config configuration file is ~/.ssh/config. This option has no effect on the z/OS-specific configuration files.
-g
Allows remote hosts to connect to local forwarded ports.
Start of change-G End of change
Start of changeCauses ssh to print its configuration after evaluating Host and Match blocks and exit. End of change
-i identity_file
Selects a file from which the identity (private key) for RSA, DSA or ECDSA authentication is read. The default is ~/.ssh/id_rsa, ~/.ssh/id_dsa, ~/.ssh/id_ecdsa, and Start of change~/.ssh/id_ed25519 End of change. Identity files can also be specified on a per-host basis in the ssh_config configuration file. It is possible to have multiple -i options (and multiple identities specified in the ssh_config configuration file).

Identity files are tried in the order they are specified. If key ring certificates have been separately specified, then they will always be tried before identity files. The certificates are used in the order they were specified, followed by the identity files in the order they were specified. The key ring certificates could be specified either via a command-line option by specifying one or more IdentityKeyRingLabel options on the -o option, or by specifying the IdentityKeyRingLabel keyword in the zos_user_ssh_config file (the z/OS-specific per-user client configuration file).

However, if an identity is loaded in an agent, regardless of whether it originated from a key ring certificate or from a file, then that identity will be tried first.

To sum it up, the order that identities are tried are as follows:
  1. Identities in the agent.
  2. The key ring certificates on the command-line option
  3. Key ring certificates specified in a zos_user_ssh_config file
  4. Identity files on the command-line option, and then
  5. Identity files specified in an ssh_config configuration file.
Restriction: This option is not supported if running in FIPS mode.
-I pkcs11
(-I is the uppercase - i). Not supported on z/OS® UNIX. Specifies which smart card device to use. Specify the PKCS#11 shared library ssh should use to communicate with a PKCS#11 token providing the user's private RSA key.
Start of change-J[user@]host[:port]End of change
Start of changeConnect to the target host by first making a ssh connection to the jump host and then establishing a TCP forwarding to the ultimate destination from there. Multiple jump hops may be specified separated by comma characters. This is a shortcut to specify a ProxyJump configuration directive.End of change
-k
Disables forwarding (delegation) of GSS-API credentials to the server.

GSS-API stands for Generic Security Services Application Programming Interface. It is a generic API for handling client-server authentication. Because it provides security services to callers in a generic way, supportable with a range of underlying mechanisms and technologies, it allows for source-level portability of applications to different environments. The only mechanism currently supported on z/OS UNIX is Kerberos V5. For more details, check IETF standard RFC 2743.

-K
Enables GSS-API authentication and forwarding (delegation) of GSS-API credentials to the server. If running in FIPSMODE, this option is not supported even if its value is specified.
-l login_name
Specifies the user to log in as on the remote machine. This option can also be specified on a per-host basis in the ssh_config configuration file.
Start of change-L [bind-address:]port:host:hostportEnd of change
Start of change-L [bind-address:]port:remote_socketEnd of change
Start of change-L local_socket:host:hostportEnd of change
Start of change-L local_socket:remote_socketEnd of change
Start of changeSpecifies that connections to the given TCP port or UNIX socket on the local (client) host are to be forwarded to the given host and port, or UNIX socket, on the remote side. This works by allocating a socket to listen to either a TCP port on the local side, optionally bound to the specified bind_address, or to a UNIX socket. Whenever a connection is made to the local port or socket, the connection is forwarded over the secure channel, and a connection is made to either host port hostport, or the UNIX socket remote_socket, from the remote machine.

Port forwardings can also be specified in the configuration file. Only the superuser can forward privileged ports. IPv6 addresses can be specified by enclosing the address in square brackets.

By default, the local port is bound in accordance with the GatewayPorts setting. However, an explicit bind_address may be used to bind the connection to a specific address. The bind_address of "local host" 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.

OpenSSH - port forwarding examples has examples of port forwarding.

End of change
-m mac_spec
A comma-separated list of MAC (message authentication code) algorithms can be specified in order of preference. ssh_config contains a description of MACs.

The MAC algorithms list might need to be modified based on the MAC algorithm source used. For more information, see the MACsSource keyword in the z/OS-specific OpenSSH client configuration files, zos_ssh_config or zos_user_ssh_config.

-M
Places the ssh client into master mode for connection sharing. Multiple -M options puts ssh into master mode with confirmation required before slave connections are accepted. ssh_config contains a description of ControlMaster.
-n
Redirects stdin from /dev/null (prevents reading stdin). This option must be used when ssh is run in the background. A common trick is to use this to run X11 programs on a remote machine.
For example:
ssh -n shadows.cs.hut.fi emacs &
Result: An emacs session is started on shadows.cs.hut.fi and the X11 connection is automatically forwarded over an encrypted channel. The ssh program is put in the background. This does not work if ssh needs to ask for a password, password phrase, or passphrase; see the -f option.
-N
Specifies that a remote command not be executed. This is useful for just forwarding ports (protocol version 2 only). This option overrides the -t option.
-o option
Can be used to give options in the format used in the ssh_config and zos_user_ssh_config configuration files. This is useful for specifying options for which there is no separate command-line flag. For full details of the available options and their values, see ssh_config and zos_user_ssh_config. The z/OS-specific per-user OpenSSH client configuration options can be specified on -o, but the z/OS specific system-wide options (see zos_ssh_config) cannot.
For example:
ssh -oHostbasedAuthentication=no Billy@us.pok.ibm.com
-O ctl_cmd
Start of changeControls the master process of a multiplexed connection. When the -O option is specified, the ctl_cmd argument is interpreted and passed to the master process. Valid commands are "check" (check that the master process is running), "exit" (request the master to exit), “forward” (request forwardings without command execution), "cancel" (cancel forwardings), "proxy" (invoke multiplexing proxy mode), “stop” (request the master to stop accepting further multiplexing requests).End of change
-p port
Port to connect to on the remote host. This can be specified on a per-host basis in the ssh_config configuration file.
-q
Quiet mode. Suppresses most warning and diagnostic messages.
-Q protocol_feature
Start of changeQueries ssh for the algorithms supported for the specified version 2 protocol_feature. The following is a list of features that can be queried: "cipher" (supported symmetric ciphers), cipher-auth (supported symmetric ciphers that support authenticated encryption), "mac" (supported message integrity codes), "kex" (key exchange algorithms), "key" (key types), key-cert (certificate key types), key-plain (non-certificate key types), protocol-version (supported SSH protocol versions). Protocol features are treated case insensitively.End of change
Start of change-R [bind_address:]port:host:hostportEnd of change
Start of change-R [bind_address:]port:local_socketEnd of change
Start of change-R remote_socket:host:hostportEnd of change
Start of change-R remote_socket:local_socketEnd of change
Start of change-R [bind_address:]portEnd of change
Start of changeSpecifies that connections to the given TCP port or UNIX socket on the remote (server) host are to be forwarded to the local side. This works by allocating a socket to listen to either a TCP port or to a UNIX socket on the remote side. Whenever a connection is made to this port or UNIX socket, the connection is forwarded over the secure channel, and a connection is made from the local machine to either an explicit destination specified by host port hostport, or local_socket, or, if no explicit destination was specified, ssh will act as a SOCKS 4/5 proxy and forward connections to the destinations requested by the remote SOCKS client.

Port forwardings can also be specified in the configuration file. Privileged ports can be forwarded only when logging in as a root on the remote machine. IPv6 addresses can be specified by enclosing the address in square brackets.

By default, TCP listening sockets on the server will be bound to the loopback interface only. This may be overridden by specifying a bind_address. An empty bind_address, or the address *, indicates that the remote socket should listen on all interfaces. Specifying a remote bind_address will only succeed if the server's GatewayPorts option is enabled (see GatewayPorts).

If the port argument is 0, the listen port will be dynamically allocated on the server and reported to the client at run time. When used together with -O forward the allocated port will be printed to the standard output

End of change
-s
Can be used to request invocation of a subsystem on the remote system. Subsystems are a feature of SSH protocol version 2, which facilitates the use of ssh as a secure transport for other applications such as sftp. The subsystem is specified as the remote command.
For example:
ssh -s host subsystem_name
User-defined subsystems (those that are not built-in) are only supported when both the OpenSSH client and server are running on a z/OS system. See Limitations for more information.
-S ctl_path
Specifies the location of a control socket for connection sharing on the string none to disable connection sharing. For more information, see the descriptions of the ssh_config keywords ControlMaster and ControlPath.
-t
Forces pty allocation. This option can be used to execute arbitrary screen-based programs on a remote program, which can be very useful, for example, when implementing menu services. Multiple -t options force pty allocation, even if ssh has no local tty. Both single and multiple uses of -t will be overridden by either the -T or -N options.
-T
Disables pty allocation. This option overrides the -t option.
-v
Verbose mode. Causes ssh to print debugging messages about its progress. This is helpful in debugging connection, authentication, and configuration problems. Multiple -v options increase the verbosity. You can specify up to three -v options.
-V
Displays the current OpenSSH and OpenSSL version information and exits.
-w local_tun[:remote_tun]
Not supported on z/OS UNIX. Requests tunnel device forwarding with the specified devices between the client (local_tun) and the server (remote_tun).

The devices can be specified by numerical ID or the keyword "any", which uses the next available tunnel device. If remote_tun is not specified, it defaults to "any". See also the descriptions of the ssh_config options Tunnel and TunnelDevice. If the Tunnel option is unset, it is set to the default tunnel mode, which is "point-to-point".

-W host:port
Requests that standard input and output on the client be forwarded to host on port over the secure channel. Implies -N, -T, ExitOnForwardFailure and ClearAllForwardings. Works with Protocol version 2 only.
Note: On z/OS UNIX, the forwarded connection to the remote host and port will not be translated.
-x
Disables X11 forwarding.
-X
Enables X11 forwarding. This can also be specified on a per-host basis in the ssh_config 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. See the description of the ssh -Y option and the ssh_config option ForwardX11Trusted for more information.

-y
Send log information to the UNIX syslog (syslogd). By default, this information is sent to stderr.
-Y
Enables trusted X11 forwarding. Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls.

ssh can additionally obtain ssh_config configuration data from a per-user configuration file and a system-wide ssh_config configuration file. For file format and configuration options, see ssh_config. ssh can also obtain z/OS-specific configuration data from a system-wide zos_ssh_config configuration file and per-user zos_user_ssh_config configuration file. For file format and configuration options, see zos_ssh_config and zos_user_ssh_config.