Basics of Secure Shell (SSH)

Basics of Secure Shell (SSH)

What is SSH?

SSH, or Secure Shell, is a remote protocol that allows users to access, control and modify their remote servers over the Internet. The OpenSSH is its most widely used client. It is available for all the most used platforms such as Windows, Linux, macOS, and more.

Syntax:

ssh user_name@host(IP/Domain_name)

The ssh command consists of three components:

  • ssh command: It tells the machine to establish a secure connection with the host.

  • User name: A server can be accessed by many users. User_name is the name of the Linux user, who has access to the Host Machine/Server.

  • Host: A host is a machine/server that is being accessed by the user. A domain name or an IP address also refers as Host.

Install OpenSSH server on Linux (Ubuntu)

To make an SSH connection, we need to have the server-side part of the SSH software in our machine. To install the SSH server, execute the below command:

sudo apt-get install openssh-serve

SSH Key Generation

To create a connection with the host client, we need a specific key for an encrypted connection. Ofcourse, you can use password. But logging in to remote host computer by ssh key is considered more secure than using a password.

ssh-keygen

The ssh-keygen command creates both public and private keys. After copying the public key to a remote host, we can establish a connection using the SSH key, not by the password.

  • ssh-keygen: It is used to create a key pair for establishing a connection and public key authentication.

  • ssh-copy-id: It is used to configure a public key as a valid user on a server.

  • ssh-agent: It is used to create an agent to hold private key for single sign-on.

  • ssh-add: It is a tool to add a key to the agent.

  • scp: It is a file transfer client that provides an RCP-like command-line interface.
  • sftp: It is a file transfer command that provides an FTP-like command-line interface.
  • sshd: It is an OpenSSH server for the Linux system.

Did you find this article valuable?

Support Srinivas Karnati by becoming a sponsor. Any amount is appreciated!