With the increasing demand for app deployment and various development, users prefer to switch to Servers that offer Root permissions. Having a Server with root permission is excellent, but as they say, with great power comes great responsibility. Often times we see that our Server is not accessible, which is why we bring the article on how to access your Linux Server.
In today’s post, we are going to check about accessing the Server using SSH, WHM, and other methods, and what to do when you are locked out of all. A pro tip on how you can use Cockpit web console to always have access to a few tools. Without further due let’s find out.
Access the Server using SSH [putty ssh client]
SSH is called a Secure Shell, it is a protocol that can be used to communicate between computers connected through a Network. If a user would like to connect to locally installed virtual box images or a live production Server, then they can connect to the particular Server using an SSH protocol. SSH connection can be made with SSH clients, for instance, Gitbash putty or terminal and many out there.
In case your goal is to use a command line interface to solve a particular problem or operate through it, then the SSH method is for you. If you wish to access the Server using SSH for whatever reason, then kindly download any of the mentioned SSH clients, for example, putty Post installation of SSH clients like Putty, you would be represented with the screen below.
To be able to connect the Server through putty, you should have your Server IP and your Server’s password. You can get the IP and password within your Server dashboard. You would want to roam your hosting provider platform in order to get the required details. Once you have the IP, you would want to put the IP in the hostname or IP address section shown above.
By default the port would be 22, you can make changes to the port on your Server under the ssh configuration file. Once you enter the IP, hit the Open button at the bottom and you would be prompted to log in as> Enter the user as root followed by the password of your Server to be able to connect to it. In case you are getting some errors while connecting through SSH, you may consider the next step which is using WHM.
Access Server using WHM
The second general Server access method is through GUI, meaning graphical User interface. This method is not for all, because Control Panel is separately charged while you purchase the Server. These WHM panels are part of licensing, hence we recommend you verify with your hosting provider whether your Server supports the WHM control panel. If it does, you may continue or you would want to access the Server with any SSH client as shared above.
The WHM control panel relies on port 2087 (especially SSL WHM). You would need to use the port along with your Server IP like https://IP:2087. You would be presented with the screen such as below.
Here, you would need to enter your username as “root” followed by your Server password. In some cases, https://IP:2087 would give you some errors. It would not load the interface as expected at all, this could be due to the IP being blocked by your Server’s firewalld. To know how you can gain access to WHM in such cases please continue the post.
What if you are locked out of SSH and WHM?
There are times when SSH and WHM both do not work. There could reason such as the SSH port being blocked, the IP is not whitelisted or there is seriously something wrong with Server. Luckily Linux has a third way in, it’s called Rescue mode. You would be able to access Rescue mode and give the reboot a try to see if it fixes your issue. In case you are not sure, you may reach out to your Server provider.
The point to note here to operate Rescue mode, one must know what they are doing. If you lack pro Server administration skills then it’s not a good idea to use Rescue Mode. But you do not worry about it, that is where Cockpit comes in. Let’s check that one out.
Redhat funds Cockpit which is a Server administration tool. The Cockpit gives you the ability to manage Server tasks through a web-based interface. This web interface works on port 9090. To access the Cockpit after installation type IP followed by port 9090. Eg – IP:9090.
This web-based interface is by default installed on CentOS 8 image. If you are running the Server with CentOS 7 then you would need to install Cockpit on your Server.
Note: Cockpit can be useful only when it’s configured on your Server and login credentials are the same as your Server.
Why Cockpit you ask? well from experience, most of the Internet Service Providers out there allocate dynamic IP to their network. If the Server firewalld or iptables is not configured to accept requests from dynamic IP then WHM login can be blocked.
The WHM may end up with errors such as “ERR_CONNECTION_TIMED_OUT”. This is due to the firewall isn’t accepting the request from the new dynamic IP the ISP has provided. To fix this and get into WHM normally, we must whitelist the IP in the firewalld in case you are using firewalld!. Aside from this, below are some key benefits to consider using Cockpit.
- A good alternative to recover the Server or fix internal Server issues if you are locked out of WHM or SSH.
- Cockpit works with other management tools without causing issues.
- Cockpit doesn’t store Server data.
- It’s free!
How to install Cockpit?
Let’s check out how you can install Cockpit. In this section, we are trying to install Cockpit for a CentOS 7 Server. In case you are wanting to install Cockpit for other distributions, please follow the link here. Ensure you are logged into your Server terminal as a root user to proceed with the following steps.
yum install cockpit -y
systemctl enable --now cockpit.socket
Add Cockpit service to Firewalld
firewall-cmd --permanent --zone=public --add-service=cockpit;firewall-cmd --reload
Whitelist IP in firewalld when WHM is not accessible
firewall-cmd --zone=trusted --permanent --add-source=IP;firewall-cmd --reload
firewall-cmd --zone=trusted --permanent --add-source=220.127.116.11;firewall-cmd --reload
When you have whitelisted the IP in firewalld through Cockpit. Re-try to access WHM using IP:8087 it should load WHM now.
Nobody likes to lose access to their Server let it be production or local. With Cockpit approach, you can always have control over the terminal from which you can manage the task and avoid being locked out. This concludes with how to access your Linux Server. Which practice do you follow to access your Server? do let us know in the comments section below. If you need any help or have any suggestions to make, do reach us via the contact page here. Happy National No-Code Day!