skip to Main Content

Goal…

I made a rails app and I want to clone it from git to cpanel. But I got stuck at the ssh login before the cloning step.

How to clone from git
https://documentation.cpanel.net/display/CKB/How+to+Host+Git+Repositories+on+a+cPanel+Account#HowtoHostGitRepositoriesonacPanelAccount-Clone

How to access with ssh
https://documentation.cpanel.net/display/CKB/How+to+Access+the+Command+Line

Error I got…

ssh: connect to host example.com port 22: Connection refused

Possible solution…

I googled and the most of online answers were to edit the port number in /etc/ssh/sshd_config. However, given myself being a beginner, I don’t even know how to edit that file. It would be great if anyone could help me with how to edit the file as well as the original issue in the above. Thanks in advance.

2

Answers


  1. In the document „Access with SSH“, there is a Note at the end:

    Note:

    If you receive an error message that appears similar to the following example, you may not have SSH privileges enabled on the server.
    ssh: connect to host example.com port 22: Connection refused
    Contact your hosting provider or system administrator for more information. Because command line access (shell access) has certain security implications, many web hosting providers restrict this access.

    There could be a lot of reasons that you get the error message, IMHO, the most possible reason is that the Server is behind a Firewall and the Port 22 for SSH is Not Open to the incoming requests.

    Login or Signup to reply.
  2. I had the same issue. What worked for me is:

    sudo mkdir /var/run/sshd
    sudo apt-get install --reinstall openssh-server
    

    I am on Ubunbut 16.04.4. If my answer doesn’t work for you, you can try some of the alternative solutions from here: connect to host localhost port 22: Connection refused.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search