Find the answer to your Linux question:
Results 1 to 6 of 6
I've been having some grief with ssh. If I leave it set to run with defaults - i.e. at port 22 I have no issues. I am running behind a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,132

    SSH Port Configuration - Setting Higher Port Numbers


    I've been having some grief with ssh. If I leave it set to run with defaults - i.e. at port 22 I have no issues. I am running behind a zyxel adsl modem/router and have NAT set to keep 22 open, and ssh set as an available service in the suse firewall. I have wanted to get ssh running on a different port with the hope that perhaps attempts at logins by script kiddies will be minimised. However when I set /etc/ssh/ssh_config to run at port 57921, set NAT on my router to forward this port and restart the sshd daemon I get the error "SSH: Connection refused on Port 57921".

    Am I missing something obvious here? I'd feel much better if I could get this running on a higher, less obvious port number. Any documentation I can find on ports seems to be relating to portforwarding and not reconfiguring existing ports. Any help appreciated.

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,849
    Did you tell the SuSE firewall to open the new port too? Normally, if you tell your firewall config to open the SSH port, it opens port 22, it doesn't monitor connection types to see what kind of service they are - i.e. it cannot open up access for data streams that carry SSH connections on any port.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,132
    I opened the port seperately in the firewall configuration. That's kind of what's bothering me, because if it was NAT I would guess that I would get no response from ssh. It seems odd that I'm getting connection refused. Do you know where security settings for ssh are - ssh_config seemed a little sparse.

  4. #4
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,849
    dohh!

    Silly me, you're running and ssh server, and you're editing /etc/ssh/ssh_config to control it. I think you need to edit /etc/ssh/sshd_config and change settings in there for the server (dont forget to restart the ssh service).

    Change the 'Port' line at the top of the file, and if you browse down the file, you'll find all sorts of things with which you can adjust the security, including the ever popular 'PermitRootLogin' which should be set to 'no'. To read the man page, use 'man sshd_config'
    Linux user #126863 - see http://linuxcounter.net/

  5. #5
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    I think you need to edit /etc/ssh/sshd_config and change settings in there for the server (dont forget to restart the ssh service).
    Correct - ssh_config is for client.

  6. #6
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,132
    Thanks guys, appreciate it

    I'll be straight on that when I get home.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •