Introduction

SSH or Secure Shell is a cryptographic network protocol that provides a secure way to access and manage network devices and servers over an unsecured network. It is widely used for securely connecting to remote systems, executing commands, and transferring files.

Prerequisites

  1. IP address or hostname of the remote server 
  2. Username
  3. Password or SSH key -You need either the password associated with the username or an SSH key pair for authentication.
  4. Port number required only for pointing to other ports or other wise the server automatically assumes the default port is 22.

Implementation :

Without port number (Default port 22):

For Password Authentication:

Open your Terminal/Command Line and run the following command.

$ ssh username@ip_address_or_hostname

If the connection is successful, you should now be logged into the remote server via SSH.

For Key-Based Authentication:

Open your Terminal and use the following command

$ ssh -i /path/to/private_key username@ip_address_or_hostname

If the connection is successful, you should now be logged into the remote server via SSH.

With port number (SSH port is configured with random port):

For Password Authentication:

Open your Terminal and use the following command.

$ ssh username@ip_address_or_hostname -p <portnumber>

If the connection is successful, you should now be logged into the remote server via SSH.

For Key-Based Authentication:

 Open your Terminal and use the following command.

$ ssh -i /path/to/private_key username@ip_address_or_hostname -p <port number>

If the connection is successful, you should now be logged into the remote server via SSH.

Note :
Remove with
1. “username”  with your actual username
2.  “ip_address_or_hostname” with the IP address or hostname of the remote server.
3. “port number” with actual pointing port number.
4. “/path/to/private_key” with the actual path/folders to your private key file.

Leave a Reply