The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Custom ssh port for CPanel SSH client

Discussion in 'General Discussion' started by yaax, Jul 30, 2004.

  1. yaax

    yaax Well-Known Member

    Joined:
    Jun 15, 2003
    Messages:
    67
    Likes Received:
    0
    Trophy Points:
    6
    Does anyone know how I can configure CPanel default SSH java client to connect to SSH to my custom port and not to default 22 port?

    I was forced to change SSH port because of security warnings, but know CPanel SSH client cannot connect - he is still trying to connect to 22 port.... It must have some way to be configured...
     
  2. sawbuck

    sawbuck Well-Known Member

    Joined:
    Jan 18, 2004
    Messages:
    1,367
    Likes Received:
    5
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    You should be able to define a custom port in /etc/ssh/sshd_config. Make sure your firewall is accepting connections thru that port. Might be a good idea to leave 22 open until you confirm that the non-standard port is working properly. As always make a backup of the original file before editing. Then restart SSH server.
    HTH
     
  3. yaax

    yaax Well-Known Member

    Joined:
    Jun 15, 2003
    Messages:
    67
    Likes Received:
    0
    Trophy Points:
    6
    I am sorry, you probably did not understood me.
    I alredy setup SSH on another port and it is working fine from all normal SSH clients who have an ability to connect to different port.
    My only problem is CPanel prebuild SSH java client software. It always try to connect to 22 port and I need to update this setting only.
     
  4. sawbuck

    sawbuck Well-Known Member

    Joined:
    Jan 18, 2004
    Messages:
    1,367
    Likes Received:
    5
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Sorry. I did misunderstand what you were asking for. Try /usr/local/cpanel/java-sys/ssh-cp.conf
    Haven't tried to change this myself but would be interested to know if that solves it for you.
     
  5. yaax

    yaax Well-Known Member

    Joined:
    Jun 15, 2003
    Messages:
    67
    Likes Received:
    0
    Trophy Points:
    6
    Thank you very much, configuration of this this file really did the job. Now CPanel shell client connecting to right port.
     
  6. rebelo

    rebelo Active Member

    Joined:
    Jun 30, 2003
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    the dark side of the moon
    Do You now if the CPanel/whm upgrades turn the port numbers back to the default one?
     
  7. JraNil

    JraNil Member

    Joined:
    Oct 12, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    When I changed the ssh port, there is error in WHM while I restart the ssh service.
    Is there anywhere in WHM configuration that we should change to tell whm about the new port?

    but it seems there is no problem with ssh , and it is working fine.
     
  8. Sheldon

    Sheldon Well-Known Member

    Joined:
    Jun 7, 2004
    Messages:
    378
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Canada
    yup you will get the error.. just ignore it.

    Sheldon
     
  9. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    Just to clear this out, during the next cpanel update, your config file is overwritten again.

    I just tested this out myself.

    What you can do is create a file /scripts/postupcp and put this inside it:

    Code:
    #!/bin/sh
    perl -pi -e 's/22/NEWPORT/g' /usr/local/cpanel/java-sys/ssh-cp.conf
    
    chmod 700 /scripts/postupcp

    The above code assumes that the ssh-cp.conf file will have 22 only for the port address ;) For now it holds true. Replace NEWPORT with your custom ssh port.

    Now everytime your cpanel updates, the ssh-cp.conf will be changed back to your custom ssh port.
     
  10. rebelo

    rebelo Active Member

    Joined:
    Jun 30, 2003
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    the dark side of the moon
    error ?

    "When I changed the ssh port, there is error in WHM while I restart the ssh service."

    What type of error ?
    From checkservd with 5 minutes emails saying that a restart was attempted ?

    If we use the /scripts/postupcp from anand before we change ports at /etc/ssh/sshd_config
    and /usr/local/cpanel/java-sys/ssh-cp.conf and then restart ssh will this error be avoided ?

    Tks for help.
     
  11. SarcNBit

    SarcNBit Well-Known Member

    Joined:
    Oct 14, 2003
    Messages:
    1,010
    Likes Received:
    3
    Trophy Points:
    38
    Why is this thread sticky?
     
  12. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Maybe someone spilt jam on it :p

    I noticed last night that some of the cPanel staff were doing a blitz (josh and nick I think) and answering posts. I would suspect they saw it and thought it merited stickiness - or maybe they got the wrong thread ;)
     
  13. SarcNBit

    SarcNBit Well-Known Member

    Joined:
    Oct 14, 2003
    Messages:
    1,010
    Likes Received:
    3
    Trophy Points:
    38
    I hope so. I would reserve sticky status for posts that are extremely timely or posts that are beneficial to a large percentage of forum members. I do not think that this post qualifies.

    I wouldn't think a lot of cpanel hosts are looking for this solution, and those that are could easily run a search on 'ssh port' and read up to find the answer.

    It is interesting sometimes to note how moderation is applied to these forums. :cool:
     
  14. Sheldon

    Sheldon Well-Known Member

    Joined:
    Jun 7, 2004
    Messages:
    378
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Canada
    ever think that they might be stickying this because of a futrue enhancement?

    and btw..

    the choice to change IP's as well would be greatly apreciated.

    ive searched the documentation for the actual java product and I cant find the
    option to specify a different IP.

    Sheldon
     
Loading...

Share This Page