ssh protocol
Want to read about ssh protocol because I have run into it a few times and want to find out how I could use it to benefit me.
References
Notes
The Secure Shell (SSH) Protocol is a cryptographic network protocol for operating network services securely over an unsecured network. Its most notable applications are remote login and command-line execution.
It was designed for Unix-like operating systems as a replacement for Telnet and unsecured remote Unix shell protocols. Secure Shell uses encryption mechanisms that are intended to hide the contents of the transmission from an observer, even if the observer has access to the entire data stream. A Finish computer scientist, Tatu Ylogen, designed SSH in 1995 and provided an implementation in the form of two commands, ssh
and slogin
.
SSH applications are based on a client-server architecture, connecting an SSH client instance with an SSH server. SSH operates as a layered protocol suite comprising three hierarchical components: the transport layer provides server authentication, confidentiality, and integrity, the user authentication protocol validates the user to the server, and the connection protocol multiplexes the encrypted tunnel into multiple logical communication channels.
SSH uses public-key cryptography to authenticate the remote computer and allow it to authenticate the user, if necessary. SSH may be used in several methodologies. In the simplest manner, both ends of a communication channel use automatically generated public-private key pairs to encrypt a network connection, and then use a password to authenticate the user. When the public-private key pair is generated by the user manually, the authentication is essentially performed when the key pair is created, and a session may then be opened automatically without a password prompt. In this scenario, the public key is placed on all computers that must allow access to the owner of the matching private key, which the owner keeps private. While authentication is based on the private key, the key is never transfered through the network during authentication. SSH only verifies that the same person offering the public key also owns the matching private key.
On Unix-like systems, the list of authorized public keys is typically stored in the home directory of the user that is allowed to log in remotely, in the file ~/.ssh/authorized_keys
. This file is respected by SSH only if it is not writable by anything apart from the owner and root.
SSH is typically used to log into a remote computer's shell or command-line interface (CLI) and to execute commands on a remote server. It also supports mechanisms for tunneling, forwarding of TCP ports and X11 connections and it can be used to transfer files using the associated SSH File Transfer Protocol (SFTP) and Secure Copy Protocol (SCP).
SSH uses the client-server model. An SSH client program is typically used for establishing connections to an SSH daemon, such as sshd
, accepting remote connections. Both are commonly present on modern operating systems.
Common SSH Commands
Description | Direct SSH Command | SSH Shell Command |
---|---|---|
Connect as a specific user. |
| N/A |
Connect using a non-standard port number. |
| N/A |
Disconnect from the remote session. | N/A |
|
Generate SSH keys to streamline authentication. |
| N/A |
Copy the local SSH public key to the remote server's authorized_keys file. |
| N/A |
Copy a file from the local machine to a remote directory. |
| N/A |
Copy a file from the remote server to the local machine. |
| N/A |
Recursively copy a local directory to the remote server. |
| N/A |
Transfer files between systems via SFTP. |
| N/A |
Compress and transfer a directory from local to remote server. |
| - |
Compress and transfer a remote directory to a local machine. |
| - |
Synchronize files from remote to local server. |
| - |
Synchronize files from local to remote server. |
| - |
List the contents of a remote directory. |
|
|
Move or rename a file on the remote server. |
|
|
Create a new directory on the remote server. |
|
|
Delete a file on the remote server. |
|
|
Change file permissions. |
|
|
Change file ownership. |
|
|
Check disk space usage on the remote server. |
|
|
Monitor the syslog file on the remote server in real-time. |
|
|
Monitor remote system performance using |
|
|
Set up local port forwarding. |
| N/A |
Set up remote port forwarding. |
| N/A |
Set up dynamic port forwarding. |
| N/A |
Mount a remote directory on your local machine via SSHFS. |
| N/A |
Keep SSH connection alive. |
| N/A |