English

Open SSH connection on Linux


This tutorial will show you how to open SSH connection on Linux directly on the console, so you don’t need to rely on third party software like Putty.

I’ve seen quite a few people relying on a Putty installation on Ubuntu and/or CentOS to access a remote server through SSH, but despite how good I think Putty is, its usage is far from necessary when you are on a Linux environment.

A Basic SSH

In order to SSH to a remote host or IP using the same username as the current one you are logged in, simply do the following:

# Using the hostname
ssh myserver.bgasparotto.com

# Using the IP
ssh 10.20.30.40

After the commands above are ran, you will probably be prompted to type the user’s password.

Specifying an username

It’s most likely that you would need to specify a different username to log into your remote host, so for an username called admin, do the following:

ssh admin@myserver.bgasparotto.com

Using a different port than 22

The ssh command attempts to connect to the port 22 by default, if you need to connect to a different port like 2222, pass the -p parameter:

ssh -p 2222 admin@myserver.bgasparotto.com

Logging out

When you are done with the remote server, just type the command below to quit:

exit

Hope it helps. Cya!

bgasparotto

Recent Posts

Python function decorator

This guide will show you how to create a Python function decorator with a few…

2 years ago

Got permission denied while trying to connect to the Docker daemon socket

This guide will show you how to fix the error Got permission denied while trying…

2 years ago

Python virtual environment on Intellij IDEA

This guide will show you how to create a Python virtual environment on Intellij IDEA…

2 years ago

Find and kill processes on Linux and Mac by port number

This tutorial will quickly show you how to to find and kill processes on Linux,…

2 years ago

Python: Relocation R_X86_64_PC32 against symbol can not be used when making a shared object Error

This guide shows a possible solution for Python error Relocation R_X86_64_PC32 against symbol can not…

2 years ago

Kubernetes useful commands

I condensed below a cheat sheet of Kubernetes useful commands. I will keep updating this…

2 years ago