List of content you will read in this article:
What is SSH?
SSH or Secure Shell is a network protocol that is used to remotely access the server. It provides you with a secure way to comply with a device over any sort of unsecured network. It’s not just about the security services; it also refers to the bag of utilities that helps to implement the SSH protocol.
Features of SSH
There are ample features associated with SSH. Let’s dive in!
- SSH comes with strong password authentication, encrypted data communication, and public-key authentication
- It is used to manage systems and applications remotely and allows others to use some other computer and perform several functions
- It is a cryptographic network protocol and uses the client/server model
- You can create secure tunnels for different application protocols too. Application protocols are further used for terminal emulation or for transferring the files
Let us now understand how SSH works?
How does SSH work?
SSH was introduced to update the insecure terminal emulation, for instance, rlogin or Telnet. SSH performs the same functions with more flexibility and comfort.
Not just this, it also replaces several file transfer programs. For instance, FTP or File Transfer Protocol and RCP or Remote Copy.
The primary aim of SSH is to connect the remote host in case of a terminal session. You use the following command to achieve the task:
Moving onto the next segment, SSH has various uses associated with it.
Take a look.
Uses of SSH
- By default, SSH comes in every Linux, Unix, and Mac server
- Various kinds of communications can be secured with the help of SSH connections between a remote host and a local machine
- It is also used to manage routers, virtualization platforms, server hardware, file transfer applications, and much more
- You can also connect to servers, use tools or the terminal to upload and exit
- SSH keys come with SSO, or single sign-on, that helps the users to move between the accounts without inserting the password every time
Additionally, it plays an important role in access management and identity management. The SSH traffic is highly encrypted as well. It also assists you with the secure issuance of commands on several remote devices. You can expect secured as well as automated file transfers. Along with that, be assured of security management of your network infrastructure components.
In a nutshell, SSH is widely used in scripts and several other software to securely access data and resources remotely.
Now, let us incline our focus on our core topic, that is, the SSH default port number.
What is SSH Default Port Number?
A connection between a wired and a wireless machine is carried out via ports. In total, there are 65,536 communication ports.
the default SSH port number is 22.
Whenever you run the command, a connection through port 22 is established between the client and the server. Every connection now initializes through this port.
Besides, there are several instances where there is a need to change the default SSH port for security purposes. The security measures become necessary to protect the server from brute force attacks.
When we talk about the brute force attack, it is an error method in order to crack the incorrect data. For instance, figuring out passwords via exhaustive efforts instead of algorithms. It basically means to hit and try until you crack the code.
Additionally, as it is evident that Port 22 is the default port for communication, thereby it becomes easier for the unauthorized party to access data.
When you switch this port to some other, then the hacker has to try several other ports to ultimately find an open port. Therefore, to put any hacker out of the bounds, this step can be taken.
But, the question is, what’s the method to change the default SSH port?
How to change the default SSH port Number?
To change your default SSH port, you have to edit the sshd_config file. Besides, it is always a good option to keep a backup of your file. Use this command to create a backup first:
ubuntu@ubuntu:~$ cp /etc/ssh/sshd_config /etc/ssh/sshd_config_backup
This command creates a copy of the file in the same directory. The next step is to change the default SSH port. Open the ssh_config file in any editor. Now, enter the following command:
ubuntu@ubuntu:~$ gedit /etc/ssh/sshd_config
After you execute this command, the mentioned file opens in the text editor. Search this line in the code:
Now, say, you want to shift your port number to 45673. For that, simply remove the hash (#) sign and insert the desired port number instead of 22.
Take a look:
Besides, do not forget to white list this port on your firewall to avoid locking yourself from your device.
Moving on, it’s time to restart SSH.
To restart the server in order to load the changes you must follow this command as given below:
ubuntu@ubuntu:~$ sudo service sshd restart
As soon as you restart your device, you can see the changes that you made.
Now, you can easily test the changes without logging out of your SSH session.
How to test the changes?
After you successfully change the default port, you must mention the port number to establish a connection with the server.
Here is the command that you need to follow:
ubuntu@ubuntu:~$ ssh username@userIP -p 45673
You set your port number as 45673.
Therefore, you can see that the process is extremely easy and simple. You need to execute a few commands and you are good to go.
In a nutshell, SSH or Secure Shell is used widely in order to access the server remotely and securely over any unsecured network.
The default port needs to change due to security purposes. There are instances where there may be some potential threat to the port. Hence, it becomes important to amend it to safeguard the network.
We hope that that information helps you to understand the basics of SSH and default port.
People Are Also Reading: