SSH COMMAND in linux  -----------------

This page is set the OpenSSH ssh command on Unix/Linux or the Mac terminal. For standard records approximately SSH and different implementations, see the SSH protocol domestic page.
Practically every Unix and Linux gadget consists of the ssh command. This command is used to begin the SSH patron program that permits cozy connection to the SSH server on a far off machine. The ssh command is used from logging into the far flung gadget, transferring documents between the 2 machines, and for executing commands at the far flung system.

Contents
SSH Command in Linux
Other SSH Commands
Using the Linux patron
Specifying a one-of-a-kind user call
Executing far flung instructions at the server
SSH client configuration record
Configuring public key authentication
Configuring port forwarding
SSH command line options
A little history
SSH COMMAND IN LINUX
The ssh command offers a relaxed encrypted connection between  hosts over an insecure network. This connection also can be used for terminal get admission to, file transfers, and for tunneling other applications. Graphical X11 applications can also be run securely over SSH from a remote region.

OTHER SSH COMMANDS
There are different SSH instructions besides the client ssh. Each has its own page.

Ssh-keygen - creates a key pair for public key authentication
ssh-reproduction-identification - configures a public key as legal on a server
ssh-agent - agent to maintain non-public key for single sign-on
ssh-upload - tool to add a key to the agent
scp - report transfer purchaser with RCP-like command interface
sftp - document transfer consumer with FTP-like command interface
sshd - OpenSSH server
USING THE LINUX CLIENT
Linux normally uses the OpenSSH consumer. The ssh command to log right into a far flung gadget is quite simple. To log in to a remote laptop known as sample.Ssh.Com, type the following command at a shell activate:

ssh sample.Ssh.Com
If this is the primary time you use ssh to hook up with this remote gadget, you may see a message like:

The authenticity of host 'sample.Ssh.Com' can not be hooked up.
DSA key fingerprint is 04:48:30:31:b0:f3:5a:9b:01:9d:b3:a7:38:e2:b1:0c.
Are you certain you need to preserve connecting (yes/no)?
Type yes to hold. This will upload the server in your list of recognized hosts (~/.Ssh/known_hosts) as visible in the following message:

Warning: Permanently delivered 'pattern.Ssh.Com' (DSA) to the listing of recognised hosts.
Each server has a number key, and the above question associated with verifying and saving the host key, so that next time you connect with the server, it is able to affirm that it absolutely is the identical server.

Once the server connection has been installed, the consumer is authenticated. Typically, it asks for a password. For a few servers, you may be required to kind in a one-time password generated with the aid of a unique hardware token.

Once authentication has been universal, you may be at the shell spark off for the far flung device.

SPECIFYING A DIFFERENT USER NAME
It is also possible to apply a exceptional username at the remote system by using entering the command as:

ssh opportunity-username@pattern.Ssh.Com
The above also can be expressed with the syntax:

ssh -l opportunity-username pattern.Ssh.Com
EXECUTING REMOTE COMMANDS ON THE SERVER
The ssh command is frequently also used to remotely execute instructions at the far off device without logging in to a shell prompt. The syntax for this is:

ssh hostname command
For example, to execute the command:

ls /tmp/document
on host sample.Ssh.Com, type the subsequent command at a shell activate:

ssh pattern.Ssh.Com  ls /tmp/doc
After authenticating to the far flung server, the contents of the faraway directory might be displayed, and you may return for your nearby shell prompt. -x Disables X11 forwarding.

SSH CLIENT CONFIGURATION FILE
The ssh command reads its configuration from the SSH consumer configuration file ~/.Ssh/config. For more data, see the page on SSH customer configuration file.

CONFIGURING PUBLIC KEY AUTHENTICATION
To configure passwordless public key authentication, you can want to create an SSH key and set up an authorized_keys record. See the pages on ssh-keygen and ssh-replica-identification for more information.

CONFIGURING PORT FORWARDING
Command-line options can be used to installation port forwarding. Local fowarding approach that a nearby port (at the purchaser laptop) is tunneled to an IP deal with and port from the server. Remote forwarding manner that a faraway port (at the server laptop) is forwarded to a given IP deal with and port from the customer gadget. See the page on configuring port forwarding on a way to configure them.

OpenSSH additionally supports forwarding Unix domain sockets and IP packets from a tunnel tool to set up a VPN (Virtual Private Network).

SSH COMMAND LINE OPTIONS
Some of the most essential command-line alternatives for the OpenSSH customer are:

-1 Use protocol model 1 only.

-2 Use protocol version 2 simplest.

-four Use IPv4 addresses best.

-6 Use IPv6 addresses most effective.

-A Enable forwarding of the authentication agent connection.

-a Disable forwarding of the authentication agent connection.

-C Use statistics compression

-c cipher_spec Selects the cipher specification for encrypting the session.

-D [bind_address:]port Dynamic application-stage port forwarding. This allocates a socket to concentrate to port on the neighborhood aspect. When a connection is made to this port, the relationship is forwarded over the at ease channel, and the utility protocol is then used to determine in which to connect with from the far flung system.

-E log_file Append debug logs to log_file rather than trendy errors.

-F configfile Specifies a in keeping with-user configuration record. The default for the in keeping with-consumer configuration file is ~/.Ssh/config.

-g Allows faraway hosts to connect with nearby forwarded ports.

-i identity_file A record from which the identification key (personal key) for public key authentication is examine.

-J [user@]host[:port] Connect to the goal host by using first creating a ssh connection to the pjump host[(/iam/leap-host) after which setting up a TCP forwarding to the ultimate destination from there.

-l login_name Specifies the person to log in as at the faraway system.

-p port Port to connect to on the remote host.

-q Quiet mode.

-V Display the model range.

-v Verbose mode.

-X Enables X11 forwarding.

A LITTLE HISTORY
SSH changed numerous older commands and protocols in Unix and Linux the 1990s. The include telnet, rlogin, and rsh.

SSH runs at TCP/IP port 22. This is right between ftp and telnet, which can be two decades older. Read the tale of how SSH were given port 22.