0

I need to use nc -lp4 5432 --allow 192.168.1.24 but I have a previous nc directive that only has it listening on localhost. It throws an error when I try overwriting it:

$ nc -lp4 5432 --allow 192.168.1.24
Ncat: Got more than one port specification: 4 5432. QUITTING.

How can I overwrite the previous instruction, or delete that listener? I've had a look around and I can't find how to get this removed.

Rich_F
  • 121

1 Answers1

2
$ nc -lp4 5432 --allow 192.168.1.24
Ncat: Got more than one port specification: 4 5432. QUITTING.

This has nothing to do with "previous" whatever. The error states that 4 (the option-argument for -p) and 5432 both specify the port, but nc that is about to listen (i.e. with -l) expects at most one port specified in the command line.

If you want to use 5432 and not 4 then either use -p 5432 or don't use -p at all. Any of these will work (one at a time), they are equivalent:

nc -l -p 5432 --allow 192.168.1.24
nc -l -p5432 --allow 192.168.1.24
nc -lp 5432 --allow 192.168.1.24
nc -lp5432 --allow 192.168.1.24
nc -l 5432 --allow 192.168.1.24