DEV Community

Mahbub R
Mahbub R

Posted on • Edited on

Access Cpanel via SSH without password

Hi, This is my very first post in this platform. I would like to show you guys today the way you can access your cpanel without password and by setting the ssh just once! and after then by using your development machine you'll be able to login to your cpanel and access the full system without any password or any other credentials. So let's just rock it.

I had previously did this same thing 2-1 years back. But I forgot now. and didn't find any good article where the process mentions properly, That's why I was messing with it for few hours and finally figured and so thought to share with you. hopefully, you'll like this post.

The very first thing is we need to open up your git bash terminal or any other bash terminal you've then

1. First we have to generate SSH key pair from your development machine

to do this follow this article Generating a new SSH key
(Also don't forget to add that to ssh agent like it showed on that article)
When you're done with creating the ssh key pair we're almost 50% done. now follow the next

2. Now let's import the created SSH key to cpanel

go to your cpanel and login into it. now find out the Security tab where you'll get a option like SSH Access
SSH Access Option click on it
Note: When you're on a fresh cpanel, this might not be enabled. so contact your cpanel provider and ask them to enable so you can access to cpanel via SSH.

Now get inside of that option and then you'll see something like that manage ssh keys click on it
manage ssh keys button

Now you have to import the key that you've generated earlier. to do that click on that button
Import Key

Now you'll get some fields that needs to be filled out with the information that you've generated to your development machine

here is how it will look like

and that's it! you've added your local generated ssh key pair to the cpanel where you want to access the panel without any password or security credentials.

Final Step is to authorize the added key pair

Now get back one step and then you'll be able to see the list of key pair you've and also you'll see the one we imported right away. You'll see something like this

click on the manage button on the right side. and then it will take you to here

Now you've to click on the authorize button. and that's it. we're done!

You have successfully added your local SSH key to server

If you don't know yet how to login then now?
That's super easy as well. You know the username and password of your hosting from there you'll have to use the username only and the domain name. that's it!
example: user_name@example.com

now open up your local computer bash terminal in my case it's git
and type command like that below
type in terminal

If you have completed all the above step successfully then you are already entered to your cpanel without typing any password.

Now to keep that configuration saved so you can use it after restarting PC

you need to do one more thing for that and that is save the private key to ssh config file so that it detect every time you want to access this server and use that key against of the host. so for that create or open the config file ~/.ssh/config like so. and then you have to add identityFile like this way.

IdentityFile location_for_the_private_key

Note: You can add as many identityFile you want to
in my case it was ~/Downloads/soci***pector_io_rsa this. If you do save this config then you're done.

That's it for today I work as a Full-Stack engineer for around 4 years. but didn't write any article to any platform this is my first post here. Pardon if any mistake happens

Thank you so much for reading this post. if you find this helpful then spread it.

Top comments (4)

Collapse
 
segebee profile image
Segun Abisagbo

this is great... thanks for sharing

Collapse
 
mahbbrah profile image
Mahbub R

I'm glad that you liked it :)

Collapse
 
godswill1 profile image
God'swill Uche

Please I would like to learn from you.

Collapse
 
mahbbrah profile image
Mahbub R

Hey, How can I Help You?