The Wayback Machine - https://web.archive.org/web/20241004191359/https://www.geeksforgeeks.org/introduction-to-sshsecure-shell-keys/
Open In App

Introduction to SSH(Secure Shell) Keys

Last Updated : 11 Feb, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

The SSH(Secure Shell) is an access credential that is used in the SSH Protocol. In other words, it is a cryptographic network protocol that is used for transferring encrypted data over the network. The port number of SSH is 22(Twenty-Two). It allows you to connect to a server, or multiple servers, without having to remember or enter your password for each system that is to log remotely from one system to another. It always comes in key pairs:

  • Public key – Everyone can see it, no need to protect it. (for encryption function).
  • Private key – Stays in computer, must be protected. (for decryption function).

Key pairs can be of the following types:

  • User Key – If the public key and private key remain with the user.
  • Host Key – If public key and private key are on a remote system.
  • Session key – Used when a large amount of data is to be transmitted.

Features of SSH

  • Encryption: Encrypted data is exchanged between the server and client, which ensures confidentiality and prevents unauthorized attacks on the system.
  • Authentication: For authentication, SSH uses public and private key pairs which provide more security than traditional password authentication.
  • Data Integrity: SSH provides Data Integrity of the message exchanged during the communication.
  • Tunneling: Through SSH we can create secure tunnels for forwarding network connections over encrypted channels.

SSH Functions

There are multiple functions performed by SSH Function, here below are some functions:

  • SSH provides high security as it encrypts all messages of communication between client and server.
  • SSH provides confidentiality
  • SSH allows remote login, hence is a better alternative to TELNET
  • SSH provides a secure File Transfer Protocol, which means we can transfer files over the Internet securely
  • SSH supports tunneling which provides more secure connection communication

SSH Protocol

To provide security between a client and a server the SSH protocol uses encryption. All user authentication and file transfers are encrypted to protect the network against attacks.

SSH ( Secure Shell Protocol )

SSH Protocol

Techniques Used in SSH

There are majorly three major techniques used in SSH, which are

  • Symmetric Cryptography: In Symmetric key cryptography the same key used for encrypting and decrypting the message, a unique single shared key is kept between the sender and reciever. For ex: DES (Data Encryption Standard) and AES (Advanced Encryption Standard).
Symmetric Cryptography

Symmetric Cryptography

  • Asymmetric Cryptography: In Asymmetric key cryptography the key used for encrypting is different from the key used for decrypting the message. For ex: RSA (Rivest–Shamir–Adleman) and Digital Signature Algorithm.
Asymmetric Cryptography

Asymmetric Cryptography

  • Hashing: Hashing is a procedure used in cryptography which convert variable length string to a fixed length string, this fixed length value is called hash value which is generated by hash function.
Hashing

Hashing

Commands in SSH

There are multiple commands supported by SSH protocol, you can tap on the link if you want to know commands in SSH

How does generally WorkThe general asymmetric?

For performing encryption and decryption it uses asymmetric cipher. There are many encryption methods:

rsa, dsa, ed25519 etc. 

The general procedure is:

  • Public keys from the local computers (system) are passed to the server which is to be accessed.
  • The server then identifies if the public key is registered.
  • If so, the server then creates a new secret key and encrypts it with the public key which was sent to it via local computer.
  • This encrypted code is sent to the local computer.
  • This data is unlocked by the private key of the system and is sent to the server.
  • The server after receiving this data verifies the local computer.
  • SSH creates a route and all the encrypted data are transferred through it with no security issues.

SSH is key-based authentication that is not prone to brute-force attack. It is more convenient and secure than login IDs and passwords (which can be stolen in the middle). There is no exposure of valid credentials, if a server has been compromised.

Generating an SSH key pair

Open your command prompt
type : ssh-keygen
Press enter
It will ask you for a location. Press Enter for default location.
If its already there, press 'y' to overwrite.
You may enter passphrase as you like, press enter.

An example of generating an SSH Key pair in the latest version of Windows 10 is given below:

SSH - Example

Generating SSH keys on Windows, Linux, generallywhich and Mac:

OMAC OsX and Linux : terminal (build in)
OWindows :- PuTTY

Frequently Asked Question on SSH – FAQs

What is SSH?

SSH(Secure Shell) is an access credential that is used in the SSH Protocol. In other words, it is a cryptographic network protocol that is used for transferring encrypted data over the network.

How does SSH provide security?

It disintegrates the data that travels over the network via encryption. All that a receiving party would discover is something like to static, meaningless random data that requires decryption.

What is the default port number of SSH?

The default port number of SSH is 22.

Distinguish between SSH1 and SSH2?

SSH2 solely employs host keys for system authentication, SSH1 encrypts distinct portions of the packets and uses both server and host keys. SSH2 uses a different networking technology than SSH1, and it is a total redesign of the protocol. SSH2 is also more secure.

What is port forwarding in SSH?

The method of sending data over an encrypted secure shell connection between a local and remote server is called SSH port forwarding, or SSH tunnelling.



Similar Reads

Difference between Secure Socket Layer (SSL) and Secure Electronic Transaction (SET)
When it comes to online security, two important technologies are available i.e Secure Socket Layer (SSL) and Secure Electronic Transaction (SET). Both are designed to protect sensitive information during online transactions, but they serve different purposes and have distinct features. This article will cover both technology, their advantages and d
3 min read
13 Best Practices to Manage SSH Keys
SSH key management is essential for securing remote access to systems and maintaining IT infrastructure security. Secure Shell (SSH) keys provide an essential safeguard for access to servers and encapsulate and encrypt data transmission over an unsecured network. Table of Content What are SSH Keys?Understanding SSH Keys13 Best Practices for SSH Key
8 min read
Secure Shell and TLS
Secure Shell : Secure Shell is designed to be very simple and cost-effective for secure network communications. SSH Client and server applications are widely available for most operating systems. SSH runs on top of TCP and has three protocol stacks as follows. SSH Transport Layer Protocol - This is mainly used for providing server authentication, d
1 min read
SECURE Shell architecture
In this article, we will discuss the overview of SSH(Secure Shell) protocol and then will mainly focus on its architecture part and will explain its working. Let's discuss it one by one. SSH(secure shell protocol) : It is a scientific discipline network protocol for operative network services over an unsecured network.It is designed to replace the
3 min read
Difference Between Bind Shell and Reverse Shell
A shell is a program that interprets our commands and gives the written commands to the operating system. It acts as an interface between the user and the operating system. It takes input from the keyboard and gives it to the OS, and the terminal lets you type commands and interact with the shell. When to Use Reverse Shell and Bind Shell?Both rever
6 min read
TELNET and SSH in Cisco devices
We can take access to a cisco router or switch either through a console cable or taking remote access through well known protocols Telnet or ssh (Secure Shell). Telnet and ssh are both application layer protocols used to take remote access and manage a device. 1. Telnet: As stated, Telnet is an application layer protocol which uses TCP port number
4 min read
TELNET and SSH on Adaptive Security Appliance (ASA)
Prerequisite - Adaptive security appliance (ASA) A user can take management access of a device through a console or remote access by using telnet or SSH. In the same way, ASA (Adaptive Security Appliance) CLI access can take through a console or by using Telnet or SSH and GUI access can be taken through (ASDM-a tool). 1. Telnet on ASA: Telnet is an
7 min read
SSH Port Forwarding
SSH Port forwarding is a method used for securing TCP/IP connections. The TCP/IP packets can be tunneled through a SSH link making the data obscure thus protecting the link from attacks. SSH Port forwarding can be also seen as a form of Virtual Private Network(VPN). Types of Port Forwarding: There are 2 main types of port forwarding: Local Port For
2 min read
Difference between SSH and SFTP
Prerequisite – Responsibilities of Transport Layer 1. Secure Shell (SSH) : It is a transport layer that is used for secure logins and share of information between two secured endpoints. It secures the exchange through public and private keys. Used for secure communications between an organization and a remote server. Advantages of SSH: Secure Conne
4 min read
Difference Between FTP and SSH
1. File Transfer Protocol (FTP) : It is a web standard that lets in the technique of document downloading and uploading on distinct pc structures from the internet. It includes unique sorts of record types. File Transfer Protocol or FTP, is a protocol that used to be created for the transferring of files from a remote place to a local computer, or
2 min read
How to Configure SSH on Cisco Routers and Switches?
Overview :SSH is a security mechanism, which can be used to access the privilege and configuration mode of a Router and a Switch from a remote location to perform the required action. The primary aim to configure SSH is to access devices deployed in a network from a remote location so that the required configuration can be performed and resources c
3 min read
Difference between SSH and SSL
Although both SSH and SSL are cryptographically designed for the protection of data transmission, they have been put to serve different purposes and run in different contexts. An understanding of the differences between SSH and SSL will enable the use of the right tool in different scenarios to secure communication and protect data. This guide expl
6 min read
Difference Between SSH Local and Remote Port Forwarding
SSH stands for "Secure Shell" or "Secure Socket Shell". It is a cryptographic network protocol that allows two computers to communicate and share the data over on insecure network such as the Internet. SSH protocols protect the network from various attacks. Local Port ForwardingLocal Port Forwarding is the common type of port forwarding. It is used
6 min read
Difference between SSH and Telnet
SSH and Telnet are two protocols commonly used to log on remotely and perform configuration and management tasks on devices that are connected via a network. Although both types of wireless networks differ slightly in general function, they have more differences in the aspects of the security features and operations. Due to the strong security meas
7 min read
Create your own secure Home Network using Pi-hole and Docker
Pi-hole is a Linux based web application, which is used as a shield from the unwanted advertisement in your network and also block the internet tracking system. This is very simple to use and best for home and small office networks. This is totally free and open-source. It also allows you to manage your accessibility and blocklist as well. It has a
3 min read
Trust Based Energy-Efficient and Secure Routing Protocols for IoT
There are many network designs and Internet of Things (IoT) models (devices) that are at work presently, but these lack either in terms of energy efficiency or aren’t optimized. To send information from source to destination node is most important task to be carried out in large scale and dynamic IoT environment. Thus, node may be repeated many tim
4 min read
SSL vs HTTPS - Which One is More Secure?
In this article, we will learn about the difference between HTTPS and SSL and then finally discuss which one of them is more reliable and secure. HTTPSHTTPS stands for Hypertext Transfer Protocol Secure. It is the basic Internet protocol used by websites on web browsers. HTTPS is the secure version of the HTTP protocol. It is encrypted so it keeps
3 min read
Which Diffie Hellman Group is Most Secure?
Answer: The most secure Diffie-Hellman group is currently considered to be Group 24 (2048-bit ECP) or higher, offering stronger encryption and resistance to attacks.The security of a Diffie-Hellman (DH) group depends on the size and type of the underlying prime numbers or elliptic curves used. Group 24 (2048-bit ECP)This group uses elliptic curve c
1 min read
How Does a VPN Ensure Secure Communication Over Public Networks?
Answer: A virtual private network (VPN) is an encrypted connection from a device to a network on the Internet. Encrypted connections help secure the transfer of sensitive information. Method for VPN Ensure Communication Over Public NetworksVPN works by creating an encrypted connection between devices. Encryption is a method of encrypting data so th
2 min read
Implement Secure Hashing Algorithm - 512 ( SHA-512 ) as Functional Programming Paradigm
Given a string S of length N, the task is to find the SHA-512 Hash Value of the given string S. Examples: Input: S = "GeeksforGeeks"Output: acc10c4e0b38617f59e88e49215e2e894afaee5ec948c2af6f44039f03c9fe47a9210e01d5cd926c142bdc9179c2ad30f927a8faf69421ff60a5eaddcf8cb9c Input: S = "hello world"Output:309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bc
15 min read
How Does a Secure Hash Algorithm work in Cryptography?
Cryptography is very much essential and vital for data encryption and decryption to safeguard sensitive and touchy data in businesses and individual. However, with the advancement of technology data breaches and cyberattacks has become very common, and need to employ different types of cryptography tools to combat such issues and problems. Hashing
9 min read
Secure Socket Layer (SSL)
Secure Socket Layer (SSL) provides security to the data that is transferred between web browser and server. SSL encrypts the link between a web server and a browser which ensures that all data passed between them remain private and free from attack. In this article, we are going to discuss SSL in detail, its protocols, the silent features of SSL, a
11 min read
Secure Electronic Transaction (SET) Protocol
Secure Electronic Transaction or SET is a security protocol designed to ensure the security and integrity of electronic transactions conducted using credit cards. Unlike a payment system, SET operates as a security protocol applied to those payments. It uses different encryption and hashing techniques to secure payments over the internet done throu
5 min read
What is Secure Email?
E-Mail is one of the most efficient methods of communication in the modern world, taking into account modern trends and the increase in the use of the internet. However, the globalization of e-mail or electronic mail as is commonly referred to, comes with its merits, but also have numerous security risks. Preventing the interception or modification
8 min read
What is Secure Boot?
The secure boot function offers a reliable method for personal computers to prevent unauthorized access or corruption of your data. Secure boot initiates a boot sequence process that checks and verifies that only authorized executable files run on your PC. What is Secure Boot?Secure boot is a security standard that ensures that only trusted softwar
7 min read
What is Secure Remote Access?
Secure remote access, As the name suggests secure means it secures our applications or business-related information. It prevents the loss of sensitive information or data. In this article, we will cover a brief explanation of secure remote access and how it works, What technologies are used for Secure Remote Access, what is important, what are the
9 min read
Difference Between Secure Socket Layer (SSL) and Transport Layer Security (TLS)
SSL stands for Secure Socket Layer while TLS stands for Transport Layer Security. Both Secure Socket Layer and Transport Layer Security are the protocols used to provide security between web browsers and web servers. The main difference between Secure Socket Layer and Transport Layer Security is that, in SSL (Secure Socket Layer), the Message diges
4 min read
Why HTTP is not Secure ?
HTTP, short for Hypertext Transfer Protocol, is a standard protocol used for data transfer on the World Wide Web. It prescribes how data should be transferred between your web browser and the server, but it has no security features, leaving it vulnerable to a large number of cyber threats, such as data tampering and interception. That lack of secur
6 min read
Difference between File Transfer Protocol (FTP) and Secure File Transfer Protocol (SFTP)
Data transfer is the most common task in network and system communications, and they involve transfer of files using two means i.e the File Transfer Protocol (FTP) and the Secure File Transfer Protocol (SFTP). FTP is a commonly applied protocol that enables files to be transferred through a network from one computer to another, but FTP is unsecure
5 min read
Introduction of Internetworking
Internetworking is combined of 2 words, inter and networking which implies an association between totally different nodes or segments. This connection area unit is established through intercessor devices akin to routers or gateway. The first term for associate degree internetwork was catenet. This interconnection is often among or between public, p
8 min read