2 - Secure SSH

Securing SSH is one of the most important task of a system administrator. CyberPanel allows you to change SSH port, disable root login and save your SSH keys.


Basic Security

Server > Security > Secure SSH

On this page you can control two settings:

  • Change Default SSH Port.

  • Allow/Disallow Root Login.


SSH Keys

To add your SSH keys, you first need to generate a pair of a public/private key.

On your local machine

cd ~/.ssh
ssh-keygen -t rsa -f cyberpanel -C root

This will generate two files cyberpanel and cyberpanel.pub.

You need to copy contents of cyberpanel.pub and paste in the following box:

Now on your local machine you can login without needing a root password using:

ssh -i ~/.ssh/cyberpanel.pub root@<IP Address>

1 Like

Hello Sir, I am mistakely disabled SSH permit root login. Now I can’t login to Cyber ​​Panel. I don’t have SSH Key. I want your help in this matter. I hope you will help me in this matter.

You can add your key from CyberPanel, similarly you can also enable root login from CyberPanel using the document above.

1 Like

Sir, I have not collected any keys from the cyber panel. I have mistakenly disabled the permit root login. After disabling, I could not log in to the cyber panel again.

You dont have SSH or CyberPanel access?

1 Like

I have cyber panel login access but I am not logging in. After disabling SSH permit root login the login page is not opening. And if you login with putty software, you will not login.

You need to contact your service provider in that case, they can help you recover the access. Not much CyberPanel can do if you don’t have access to CyberPanel

No, i dont have access to CyberPanel login. login page is not displaying. I tried putty and windows powershell to access cyberpanel.

Try to Disable the ad blocker, Sometimes Cyberpanel login page not load properly/display because of the ad blocker.

cyberpanel and cyberpanel.pub can be found in this folder:
/root/.ssh

Here

2 Likes

I got the same issue here,

Is there has anyone solved the issue?

The login page is not displayed, but I still have access via SSH

the main problem is login page cannot be accessed, it just blank

I got the solution

To enable permit root login in CyberPanel, follow these steps:

  1. Log in to your CyberPanel server as the root user.
  2. Open the SSH configuration file using a text editor, such as Nano:

Copy code

nano /etc/ssh/sshd_config
  1. Locate the line that reads “PermitRootLogin no” and change it to “PermitRootLogin yes”.
  2. Save and close the file.
  3. Restart the SSH service to apply the changes:

Copy code

systemctl restart ssh

This will disable root login via SSH for your CyberPanel server. Please note that you should still be able to log in as the root user using other methods, such as the console or a terminal emulator. It is generally considered a best practice to disable root login via SSH for security reasons.

But I still have an issue where the login page cannot be accessed

When i paste my public key and click SAVE then i receive error:

“Could not connect. Please refresh this page.”

Why? How to fix it? I cant add key.

regards

How do I generate SSH key for Rsync.net?

I accidentally generated the key pair inside my cyberpanel. Now, if I try to paste the key generated from my local machine it won’t let me paste it in secure SSH. is there any work around on how to fix this?

Generate new Keys pair, add the .pub content to cyberpanel ssh key value. Should be ok. Once you can login. Go ahead delete the old one

Well none is working for me i still get permission denied

I too was having problems with SSH to my VPS as root.
The instructions at the top of this post is the only way I solved it but after great deliberation.
For me the last line in the post was causing the issue.

ssh -i ~/.ssh/cyberpanel.pub root@

For me I was using Windows Terminal. What I realised was that I was being told to push the wrong file.

If anyone reading this is still having problems then try running the last command with out the pub extension, that is the wrong key file.

ssh -i ~/.ssh/cyberpanel root@

Try that command instead and see how that works out for you.

Best of luck
T