0

When I run the command nc -l -p 443 it starts listening but when I try connecting to it it fails. A few hours later I tried with verbose mode nc -lvp 443 and it printed out listening on [any] 2443. Then I figured out that it's not listening on the correct port. Any ideas why it's listening on port 2443 instead of port 443?

  • 1
    You are not doing this as root, I guess? – Panki May 21 at 9:53
  • 1
    What implementation of nc are you using and what Unix are you running? – Kusalananda May 21 at 10:15
0

With default setup, only root can bind to ports lower than 1024.

panki@REDACTED:~$ nc -lvp 443                                                                                         
Can't grab 0.0.0.0:443 with bind : Permission denied                                                                    
panki@REDACTED:~$ sudo !!                                                                                             
sudo nc -lvp 443                                                                                                        
listening on [any] 443 ...

More about this is already said here: Why are the first 1024 ports restricted to the root user only?

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.