1

I am trying to setup ssh on my port 443 but unfortunately I am not able to do it.

Here are the things I tried.

  1. Set up the remote daemon running sshd on port 443 and restarted sshd service.

    sshd -p 443 
    
  2. I edited the /etc/ssh/sshd_config file and added the below line and restarted the sshd service.

    Port 443
    

Now, even after performing the above steps in the remote machine, if I try and connect to port 443 of my remote machine, I couldn't connect. This is what happens when I try to connect my remote machine.

ssh -v -p 443 ramesh@192.168.104.167
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.104.167 [192.168.104.167] port 443.
debug1: connect to address 192.168.104.167 port 443: Connection refused
ssh: connect to host 192.168.104.167 port 443: Connection refused

Is there some step that am missing? How could I enable port 443 to accept ssh connections so that I could achieve this?

EDIT

The output of netstat --inet --inet6 -ln command is as below.

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State     
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:41138           0.0.0.0:*               LISTEN    
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN    
tcp6       0      0 :::111                  :::*                    LISTEN    
tcp6       0      0 ::1:631                 :::*                    LISTEN    
tcp6       0      0 :::51578                :::*                    LISTEN 
13
  • There's a firewall in the way. Does it work from localhost? Take it from there. Nov 7, 2014 at 2:35
  • @Gilles, I have stopped the firewall in the remote machine but it still doesn't work.
    – Ramesh
    Nov 7, 2014 at 2:37
  • What is the output of netstat --inet --inet6 -ln? Nov 7, 2014 at 2:39
  • 1
    Maybe an LSM (SELinux, AppArmor) is active which kills sshd when it tries to bind to ports different from 22. Nov 7, 2014 at 2:56
  • 1
    @HaukeLaging, thanks. That was it. I disabled selinux and tried. Now, I am getting No route to host error which is irrelevant to this question. Could you please post it as an answer so that I can accept it?
    – Ramesh
    Nov 7, 2014 at 3:06

1 Answer 1

3

If a daemon is configured to a non-standard port, started but does not appear in the netstat listing, then the reason may be that an active LSM (Linux Security Module) like SELinux or AppArmor forbids the daemon to bind to that port.

So check whether such a feature is active. If so then deactivate it for testing, and if that solves the problem then reconfigure the LSM so that the new port is allowed for this daemon.

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.