ssh Command
Purpose
Establishes encrypted remote shell sessions by using the SSH protocol.
Syntax
ssh [ -4 ] [ -6 ] [ -F file ] [ -h ] [ -i file ] [ -o option=value ][ -p port ] [ -q ] [ -v ] [user@]hostname [ command ]
Description
The ssh command establishes encrypted remote shell sessions by using the SSH protocol. In PowerVC virtual appliance, only outbound client connections to pre-approved hosts and ports are allowed for security. Server mode, key generation, or privileged operations are not allowed.
Flags
| Items | Description |
|---|---|
| -4 | Uses only the IPv4 addresses when SSH connects to a remote host. |
| -6 | Uses only the IPv4 addresses when SSH connects to a remote host. |
| -h or --help | Displays help about the ssh command. |
| -F file | Specifies an alternative configuration file. The ssh command looks for configuration settings in the ~/.ssh/config file by default. If the -F flag is used with the ssh command, the ssh command looks for the configuration settings in the specified file. |
| -i file | Uses a specific private key (identity file) for authentication to login to a remote server. |
| -o option=value | Specifies configuration settings in the format option=value. This option
is useful for advanced SSH configuration. For example, StrictHostKeyChecking=no,
ConnectTimeout=10. |
| -p port | Specifies a port to connect to a remote server. By default, SSH uses port
22. Only nonprivileged ports (>1024) are allowed unless a port is
pre-approved. |
| -q | Suppress warnings and diagnostic messages. |
| -v | Enables verbose output. This option displays the debugging messages, which is useful to debug connection issues. |
Positional arguments
| Item | Description |
|---|---|
| user@hostname | Specifies the remote username and the hostname in
user@hostname format (For example
alice@xxx.xxx.x.xxx). If the username is omitted, the current local username is used. The
hostname argument can be a domain name or an IP address of the remote system.
This argument is a required field. |
| command | The command argument specifies one or more commands that must run on the remote server after the secure connection is established. This argument is optional. |
Examples
- To connect to a remote host and start an interactive shell, enter the following
command:
ssh user@example.com - To connect to a remote host by using specific port and key, enter the following
command:
ssh -p 2222 -i ~/.ssh/id_ed25519 user@backup.server - To connect to a remote server and run the df -h command remotely, enter the
following command:
ssh user@web01 'df -h /' - To establish a quiet connection with timeout, enter the following
command:
ssh -q -o ConnectTimeout=5 user@monitor.local uptime - To use only the IPv4 address and disable host key checking for automation, enter the following
command:
ssh -4 -o StrictHostKeyChecking=no user@monitor.local