Introduction to SSH (Secure Shell)

Aqeel Abbas
4 min readJan 25, 2024

SSH, also known as Secure Shell or Secure Socket Shell, is a network protocol that helps users connect to another computer over an unsecured network.

In this article, we will be diving deep into SSH.

What is SSH?

The Secure Shell (SSH) network protocol uses encryption to allow two connected devices—usually a server and a client—to communicate securely with one another. It enables users to safely command and control distant machines. Conventional methods that transfer data in plain text, such as Telnet, FTP, and login, can be safely replaced with SSH. File transfers, network service tunneling, and remote administration are among its common uses.

What does SSH do?

Secure Communication: A client and a server can communicate securely thanks to SSH. To prevent unwanted access to the data, it encrypts all information sent over the network, including passwords, usernames, and other private data.

Authentication: SSH offers methods for confirming the legitimacy of the client and server. To confirm the parties’ identities, it makes use of cryptographic keys. Only authorized users and servers can access the system thanks to this authentication procedure.

Data Transfer via Encryption: SSH encrypts all data transferred between the client and server to prevent bad actors from listening in on it or altering it. The confidentiality and integrity of the data being transferred are guaranteed by this encryption.

Remote Access: SSH is primarily used to enable safe remote access to computers, servers, and other resources. With SSH, users can safely run remote commands or access a server’s command-line interface from a distance.

File Transfer: SSH facilitates safe file transfers between computers by using programs such as Secure Copy Program (SCP) and SSH File Transfer Protocol (SFTP). With the help of these tools, users can safely move data between two remote servers or between a local computer and a distant server.

Tunneling: The ability to build secure channels for the transmission of other network protocols over SSH is made possible by the functionality for tunneling provided by SSH. Services that might not be immediately accessible via the network, such as web servers, databases, and email servers, can now be accessed securely thanks to this capability.

How Does SSH Work?

The architecture of Secure Shell; Credit: nwkings.com

The architecture of Secure Shell is client-server. A server administrator typically installs a program on the server that controls whether incoming connections are accepted or rejected. In addition, a client program that a user runs on their PC makes requests to the server. The server listens on HTTP port 22 by default.

SSH Commands

To securely communicate with remote servers or devices, utilize Secure Shell (SSH) commands. The following SSH commands are frequently used:

  • ssh: To establish an SSH connection with a remote server, use the ssh command. The fundamental syntax is as follows:
ssh username@hostname
  • scp: Secure file transfers between hosts are accomplished with the scp command. This represents a “secure copy.” The fundamental syntax is as follows:
scp file.txt username@hostname:/remote/directory
  • sftp: The sftp command is an interactive file transfer tool that functions similarly to FTP but encrypts the connection using Secure Shell. Users can safely move files between hosts with its help. To initiate an SFTP session, just enter:
sftp username@hostname
  • ssh-keygen: SSH key pairs are created with the ssh-keygen command and are used for authentication. It generates public and private keys that enable password-free remote server authentication. The fundamental syntax is as follows:
ssh-keygen -t rsa

Where Should Secure Shells Be Used?

Remote Server Administration: To safely administer servers and networking equipment remotely, system administrators use SSH. They can change setups, carry out commands, and resolve problems without jeopardizing security.

File Transfer: Secure file transfers between systems are accomplished via SSH. SSH File Transfer Protocol (SFTP) and Secure Copy (SCP) are two examples of utilities that let users securely transfer files between two distant systems or between local and remote systems.

Tunneling: SSH provides tunneling, which enables users to safely access services that aren’t available directly over the network. To securely access web servers, databases, or other services, for instance, users can set up SSH tunnels.

Secure Remote Access: SSH offers a safe way for people who are located far away to gain secure online access to internal networks or systems. SSH allows remote workers, contractors, and partners to safely access resources and carry out work from a distance.

Which port is used by SSH?

The default port for SSH is 22. Firewalls can occasionally prevent access to some ports on servers they are protecting while leaving port 22 open. Because packets destined for port 22 are not banned and can be diverted to any other port, SSH is advantageous for gaining access to servers located on the other side of the firewall.

Conclusion

To sum up, Secure Shell (SSH) is a key component of secure network communication because it provides strong authentication and encryption procedures that guarantee the integrity and confidentiality of data transferred between a client and a server. SSH has become a vital tool for system administrators, developers, and remote workers due to its ability to securely command and control remote machines, permit file transfers, and enable secure access to otherwise inaccessible services through tunneling.

Does your network architecture currently make use of SSH for remote administration?

Hope, it helps.

Don’t forget to follow me on LinkedIn and Twitter.

--

--

Aqeel Abbas

Full Stack Developer | System Admin | VoIP Developer