SSH (Secure Shell) is a secure protocol for accessing remote servers. It allows administrators to manage and control servers remotely. Three methods for connecting to SSH from a desktop Linux or Ubuntu computer will be examined in this tutorial:
- leaving out port 22, which is the SSH port by default.
- using a special SSH port.
- combining files in.ppk or.pem formats with a custom port.
- How to add a Configuration file for SSH Connections
1. Create an SSH connection without selecting a port.
If port 22, the default SSH port, is being used by the server, no additional configuration is required.
How to Establish a Connection: How to Get in Touch
- Open the Terminal on the desktop of Ubuntu or Linux.
- Use the following command:
SSH username@server_ip
Replace username with the SSH username and server_ip with the IP address of the remote server.
For example, ssh root@192.168.1.100
What Takes Place:
- The SSH client uses port 22 by default.
- The user’s password must be entered.
2. Connect to SSH Using a Custom Port
If the server is configured to use the non-default SSH port, you need to include it in the command.
How to Establish a Connection: How to Get in Touch
- Locate the server’s configured custom port number, such as 2232.
- Use the -p option of the SSH command to specify the port:
ssh -p <port_number> <username>@<hostname_or_ip_address>
For example, ssh -p 2222 user@192.168.1.100
- The SSH client connects to the specified custom port.
- Enter the password when prompted.
3. Connect to SSH using a use.ppk or.pem files.
Private keys (.ppk or.pem) are commonly used for passwordless SSH authentication.
Make sure the permissions are set correctly and that the.pem file is on your local computer:
- chmod 600 keyfile.pem
- Use the SSH command with the -i option to set the private key ppk or pem
- SSH -i /path/to/keyfile.pem -p port_number username@server_ip
- For instance, ssh -i ~/keys/TokyoKey.pem -p 2222 ubuntu@192.168.1.100
Linux SSH clients frequently use.pem files. To use A.ppk files, convert them to the.pem format using
(How to Convert PEM to PPK Format on Linux and Windows)