Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SSH Port change problem for SFTP

Discussion in 'Security' started by DemonMaestro, Dec 1, 2018.

  1. DemonMaestro

    DemonMaestro Member

    Joined:
    Nov 30, 2018
    Messages:
    16
    Likes Received:
    4
    Trophy Points:
    78
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    Good day,
    I am able to change the port via following How to Secure SSH - cPanel Knowledge Base - cPanel Documentation and Tips to Make Your Server More Secure - cPanel Knowledge Base - cPanel Documentation...
    I had did a "netstat -lnp | grep sshd" and it shows my "new" port as well. So I logout of the ssh connection and go to relogin via the new port and it just sits there and then says connection timed out. It doesn't ask me for my login details or anything.

    So I have to go into WHM and to terminal and change it back to default 22. Boom everything works back the way it should. What am I missing?

    Then I've tried to login even on port 22 via SFTP and it doesn't work. I am told that I need to enable Shell Access. But I've read from this "fairly old thread" that I don't need Shell Access enabled to get it to work? SFTP without Shell Access?

    Thank you for all the help.
     
  2. HostSane

    HostSane Member

    Joined:
    Nov 26, 2018
    Messages:
    17
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Mumbai
    cPanel Access Level:
    Root Administrator
    When you are changing the SSH the port to some different port , make sure you have opened that port in firewall , that is either iptables or CSF and that should fix the issue.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    cPanelLauren likes this.
  3. Eminds

    Eminds Well-Known Member

    Joined:
    Nov 10, 2016
    Messages:
    312
    Likes Received:
    28
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    you will need to tweak the firewall configuration on your server in order to make sure that the server listens on new SSH port.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. ronaldst

    ronaldst Well-Known Member

    Joined:
    Feb 22, 2016
    Messages:
    78
    Likes Received:
    11
    Trophy Points:
    8
    Location:
    Norway
    cPanel Access Level:
    Root Administrator
    Without knowing for sure it appears reasonable to think your new port is blocked by the firewall.

    Are you running CSF?

    Shell access is required for the user you try to login with. By default root got SSH access if not configured otherwise.

    SFTP uses the same port as SSHD.
     
  5. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,254
    Likes Received:
    479
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    As suggested already here you need to ensure the new port is added in the firewall, you also need to ensure that you restart the sshd service once you modify the port.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. DemonMaestro

    DemonMaestro Member

    Joined:
    Nov 30, 2018
    Messages:
    16
    Likes Received:
    4
    Trophy Points:
    78
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    Thank you for the reply's. Apparently I didn't set to get notified of reply's.

    I will check to see if it is a firewall issue. I didn't setup a "server" firewall but it may still set it up automatically.
    I will report back with my findings.
    Thank you for the feedback.
     
    cPanelLauren likes this.
  7. DemonMaestro

    DemonMaestro Member

    Joined:
    Nov 30, 2018
    Messages:
    16
    Likes Received:
    4
    Trophy Points:
    78
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    I installed the CSF and changed the port.
    And then it's like magic it all works! :)

    Thank you everyone for the help!
     
    cPanelLauren likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice