1

I updated my SSH port from 22 to 6433 and now I can't SSH into my machine. I updated this line in /etc/ssh/sshd_config:

# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
Port 22

to

# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
Port 6433

I restarted my ssh service using

$ service sshd restart

no errors were returned. Open up a new Terminal tab and run:

$ ssh user@ip.address -p6433

which returns:

ssh: connect to host ip.address port 6433: No route to host

Not sure how to go about fixing?

update -

SELinux is not enabled

  • You may have selinux turn on and as the comment right above Port line on the text you copied says you may need to update selinux with semanage. – Mehmet Aug 8 '18 at 15:27
  • 1
    If the SSH server wasn't listening on that port, you would have gotten Connection refused. Now you're getting No route to host which means that the client can't even see the host on the network. – Kusalananda Aug 8 '18 at 15:27
  • @Mehmet selinux doth be disabled I'm afraid :/ – treyBake Aug 8 '18 at 15:28
  • @Kusalananda which is weird, because my connect session is fine in the sense of ifconfig shows expected values – treyBake Aug 8 '18 at 15:29
  • 5
    Check if iptables/firewall-cmd is configured to allow your new port. If that is not the cause, check if you are accessing the ip address through another network device. In that case the new port must be opened there as well. – Vinod Aug 8 '18 at 15:31
3

Thanks to @Vinod I got on the right track, achieved by doing:

$ firewall-cmd --zone=permanent --add-port=6433/tcp
$ firewall-cmd --reload

now I can SSH into my server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.