SSH is an application layer protocol for ensuring the security of your communication while you operate with an insecure network. It is one of the most crucial protocols of information security. Most flavors of the Linux operating system have SSH installed by default on them. However, you can always check if it is running on your system or not.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related SSH queries.
In this context, we shall look into the best way to Check if SSH is Running on Your Linux Mint 20 System.
To check if the SSH server is running on a Linux Mint 20 system, any of the following methods can be used.
1. Checking SSh status via the "systemctl" Command
Via this method, you will need to execute the command shown below:
$ sudo systemctl status sshd
If you see the "active (running)" status in the output of this command then this is an indication that SSH is running on our Linux Mint 20 system.
2. Checking SSh status via the "ps" Command
The "ps" command can be used in the following manner to check if SSH is running on our Linux system or not:
$ ps aux | grep sshd
The "listener" status against the sshd process in the output of this command implies that SSH is running on our Linux Mint 20 system.
3. Checking SSh status via the "telnet" Command
The "telnet" utility can also be used to check the status of SSH by executing the command shown below:
$ telnet localhost 22
Here, "22" refers to the port to which SSH is allowed to listen by default. However, if in your case, you have configured it to listen on some other port, then you will have to replace "22" with your specific port number.
If the connection to the specified port has been made successfully, then SSH is running on the Linux Mint 20 system.
4. Checking SSh status via the "netstat" Command
The "netstat" command can also be used to check the status of SSH. However, before doing so, the "netstat" command should be installed on your Linux Mint 20 system. It can easily be installed through the execution of the below-shown command:
$ sudo apt install net-tools
The "netstat" command resides within the "net-tools" package. Once this package will be successfully installed, you will be able to use the "netstat" command.
Now, you can use the "netstat" command to check SSH status in the following manner:
$ sudo netstat –plant | grep :22
The output of this command will verify that SSH is listening on port 22 on our Linux Mint 20 system.
5. Checking SSh status via the "lsof" Command
Finally, we can use the "lsof" command to check if SSH is running on our Linux system or not by executing it in the manner shown below:
$ sudo lsof –i
You can skip the "sudo" keyword in this command if you are a "root" user.
The "LISTEN" status with the sshd process indicates that SSH is running on our Linux Mint 20 system.
This article covers different methods of checking if SSH is running on your Linux Mint 20 system or not. Enabling SSH on Ubuntu is one of the tasks to do after the fresh installation of OS and helps you to connect your system remotely and perform tasks securely.
How to Allow SSH in Firewall ?
You may need to allow SSH incoming connections in firewall. So, use the below command to create a rule in UFW to allow SSH connections from external machines.
$ sudo ufw allow ssh
$ sudo ufw enable
$ sudo ufw reload
How to Disable SSH on Ubuntu / Linux Mint / Debian ?
For any reason you want to disable SSH on your system, you can just stop the SSH service by running the below command:
$ sudo systemctl stop ssh
Also, you need to disable the SSH service so that it doesn't start on system reboot:
$ sudo systemctl disable ssh