← Back to list

SSH

SSH, or Secure Shell, is a cryptographic network protocol used for secure communication over an unsecured network. It is widely used for…

Mallikarjun · 2025-04-21 08:24 · 0 claps · 2.1 min read
#ssh #ssh-keys #ssh-keygen #scp #ssh-copy-id
Open on Medium ↗
Wiki topics: CRY · Crypto & Web3

SSH

SSH, or Secure Shell, is a cryptographic network protocol used for secure communication over an unsecured network. It is widely used for remote administration of systems and secure file transfers. SSH provides a secure channel over an unsecured network by using a client-server architecture, where the SSH client connects to the SSH server.

Key Features of SSH

  1. Encryption: SSH encrypts the data transmitted between the client and server, ensuring confidentiality and integrity.

  2. Authentication: SSH supports various authentication methods, including password-based and public key-based authentication.

  3. Port Forwarding: SSH can tunnel other protocols through its secure connection, allowing secure access to services on remote servers.

  4. Secure File Transfer: SSH includes protocols like SCP (Secure Copy Protocol) and SFTP (SSH File Transfer Protocol) for secure file transfers.

How SSH Works

  1. Client-Server Model: The SSH client initiates a connection to the SSH server. The server listens for incoming connections on a specific port (default is port 22).

  2. Key Exchange: During the initial connection, the client and server perform a key exchange to establish a secure session. This involves generating session keys that will be used for encryption.

  3. Authentication: The client authenticates itself to the server using one of the supported methods (password, public key, etc.).

  4. Secure Communication: Once authenticated, the client and server can communicate securely using the established session keys.

Example Usage of SSH

  1. Connecting to a Remote Server

To connect to a remote server using SSH, you can use the following command in a terminal:

ssh username@hostname

  • username: The username you want to log in as on the remote server.

  • hostname: The IP address or domain name of the remote server.

Example:

ssh user@example.com

This command will prompt you for the password associated with the user account on the remote server.

  1. Using Public Key Authentication

To set up public key authentication, you need to generate a key pair (public and private keys) on your local machine:

ssh-keygen -t rsa -b 2048

This command generates a 2048-bit RSA key pair. You will find the keys in the ~/.ssh/ directory (by default, id_rsa for the private key and id_rsa.pub for the public key).

Next, you need to copy the public key to the remote server:

ssh-copy-id username@hostname

After this, you can log in without a password:

ssh username@hostname

  1. Secure File Transfer with SCP

You can use SCP to securely copy files between your local machine and a remote server. The syntax is:

scp local_file username@hostname:/remote/directory/

Example:

scp myfile.txt user@example.com:/home/user/

This command copies myfile.txt from your local machine to the /home/user/ directory on the remote server.

  1. Port Forwarding

SSH can also be used for port forwarding, which allows you to securely tunnel traffic from a local port to a remote port. For example, to forward local port 8080 to port 80 on a remote server:

ssh -L 8080:localhost:80 username@hostname

After running this command, you can access the remote server’s web service by navigating to http://localhost:8080 in your web browser.

Conclusion

SSH is a powerful tool for secure remote administration and file transfer. Its encryption and authentication mechanisms make it a preferred choice for system administrators and developers. Understanding how to use SSH effectively can greatly enhance your ability to manage remote systems securely.


메타데이터
post_id
11bfcceac760
slug
ssh-11bfcceac760
url
https://medium.com/@tmreddy.ai/ssh-11bfcceac760
canonical_url
https://medium.com/@tmreddy.ai/ssh-11bfcceac760
author_url
https://medium.com/@tmreddy.ai
status
ok
fetched_at
2026-08-06 00:06:51