Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

netcat usage.

571 views
Skip to first unread message

Peter Easthope

unread,
Feb 23, 2014, 1:10:02 PM2/23/14
to
Can anyone offer a solution for this?

[user@computer ~]$ nc -l 25 -e /usr/sbin/ssmtp
Ncat: bind to :::25: Permission denied. QUITTING.

Thanks, ... Peter E.

--
Telephone 1 360 639 0202. Bcc: peter at easthope.ca "http://carnot.yi.org/ "



--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/9802e1a04541ccc2a9d2...@easthope.ca

Mark Carroll

unread,
Feb 23, 2014, 1:20:03 PM2/23/14
to
"Peter Easthope" <pe...@easthope.ca> writes:

> Can anyone offer a solution for this?
>
> [user@computer ~]$ nc -l 25 -e /usr/sbin/ssmtp
> Ncat: bind to :::25: Permission denied. QUITTING.

Maybe you need to be root? I doubt regular users can bind to ports below
1024.

-- Mark


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/878ut1k...@ixod.org

Brian

unread,
Feb 23, 2014, 2:50:01 PM2/23/14
to
On Sun 23 Feb 2014 at 09:15:59 -0800, Peter Easthope wrote:

> Can anyone offer a solution for this?
>
> [user@computer ~]$ nc -l 25 -e /usr/sbin/ssmtp
> Ncat: bind to :::25: Permission denied. QUITTING.

Which netcat are you using? Mine (which I will not reveal :) ) does does
not offer -e as an option.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/2302201419390...@desktop.copernicus.demon.co.uk

David Glover-Aoki

unread,
Feb 23, 2014, 4:10:01 PM2/23/14
to
On Sun, 23 Feb 2014 09:15:59 -0800
"Peter Easthope" <pe...@easthope.ca> wrote:

> Ncat: bind to :::25: Permission denied. QUITTING.

Only the superuser can bind to ports below 1024.

--
David Glover-Aoki
http://david.gloveraoki.net/contact
signature.asc

Pascal Hambourg

unread,
Feb 23, 2014, 6:40:01 PM2/23/14
to
David Glover-Aoki a écrit :
>
> Only the superuser can bind to ports below 1024.

Actually not. It just requires that the process has the
CAP_NET_BIND_SERVICE capability.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/530A82A...@plouf.fr.eu.org

Peter Easthope

unread,
Feb 24, 2014, 12:50:02 AM2/24/14
to
References: <a7f1e371d326618f1b48...@easthope.ca>
<530A9882...@gmail.com>

From: Scott Ferguson <scott.ferguso...@gmail.com>
Date: Mon, 24 Feb 2014 11:55:30 +1100
> NOTE: there four different "netcats" available in Wheezy.

I found three.
netcat-openbsd, netcat-traditional, netcat6.

netcat-openbsd pleads ignorance.
peter@dalton:~$ nc -l 25 -e ssmtp
nc: invalid option -- 'e'
...

netcat-traditional listens on the port; or appears to and does nothing.
peter@dalton:~$ nc -l 25 -e ssmtp
[gears humming]

netcat6 refuses.
peter@dalton:~$ nc -l -p 25 -e ssmtp
nc: bind to source :: 25 failed: Permission denied
nc: bind to source 0.0.0.0 25 failed: Permission denied
nc: failed to bind to any local addr/port

From: Brian <ad...@cityscape.co.uk>
Date: Sun, 23 Feb 2014 23:17:04 +0000
> You start a thread. You then respond to it and break the thread.
> Do you do this by design?

The browser doesn't have a means to include References in the header.
Sorry. References are at the top of the message and I can include
References in the header when mail is working again. More explanation here.
https://wiki.debian.org/DebianMailingLists#Message_Threading_and_Replying

From: Pascal Hambourg <pas...@plouf.fr.eu.org>
Date: Mon, 24 Feb 2014 00:22:10 +0100
[Binding to a port below 1024] just requires that the process has the
CAP_NET_BIND_SERVICE capability.

Thanks. With that tip I might make nc in netcat6 work.

Regards, ... Peter E.

--
Telephone 1 360 639 0202. Bcc: peter at easthope.ca "http://carnot.yi.org/ "



--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/42bd69db811dccd3eeed...@easthope.ca

Scott Ferguson

unread,
Feb 24, 2014, 4:10:02 AM2/24/14
to
On 24/02/14 15:44, Peter Easthope wrote:
> References: <a7f1e371d326618f1b48...@easthope.ca>
> <530A9882...@gmail.com>
>
> From: Scott Ferguson <scott.ferguso...@gmail.com>
> Date: Mon, 24 Feb 2014 11:55:30 +1100
>> NOTE: there four different "netcats" available in Wheezy.
>
> I found three.
> netcat-openbsd, netcat-traditional, netcat6.

OK. I miscounted transitional as a separate package.

>
> netcat-openbsd pleads ignorance.
> peter@dalton:~$ nc -l 25 -e ssmtp
> nc: invalid option -- 'e'
> ...
>
> netcat-traditional listens on the port; or appears to and does nothing.
> peter@dalton:~$ nc -l 25 -e ssmtp
> [gears humming]

What are the contents of the file "ssmtp"?

>
> netcat6 refuses.
> peter@dalton:~$ nc -l -p 25 -e ssmtp

"-p 25" is not the same as "-l 25"

> nc: bind to source :: 25 failed: Permission denied
> nc: bind to source 0.0.0.0 25 failed: Permission denied
> nc: failed to bind to any local addr/port

$ nc -lvv -p 1025 -w 2;nc -lvv -p 25
listening on [any] 1025 ...
no connection : Connection timed out
Can't grab 0.0.0.0:25 with bind : Permission denied

(netcat-traditional 1.10-40)



Kind regards

<snipped>


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/530B0A36...@gmail.com

Zenaan Harkness

unread,
Feb 24, 2014, 4:10:02 AM2/24/14
to
I'd include socat in the list, but perhaps it's command line options
are different? socat is my preferred network swiss army knife.

A little different, but there are also netsed, netrw etc.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAOsGNST1WYd9Dg3KCmqe5yzUgmQSq=oQaO008WHK...@mail.gmail.com

Scott Ferguson

unread,
Feb 24, 2014, 4:20:01 AM2/24/14
to
On 24/02/14 20:07, Zenaan Harkness wrote:
> I'd include socat in the list, but perhaps it's command line options
> are different? socat is my preferred network swiss army knife.
>
> A little different, but there are also netsed, netrw etc.
>
>

And the excellent crypcat - but I just counted the ones with netcat in
their name (in case the OP was, um, fussy about it), not necessarily
their functionality. I don't know what the actual criteria for being
"netcat" is, for me if it does the job and is in /etc/alternatives I'm
happy.


Kind regards



--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/530B0E58...@gmail.com

Brian

unread,
Feb 24, 2014, 5:30:02 AM2/24/14
to
On Mon 24 Feb 2014 at 20:18:16 +1100, Scott Ferguson wrote:

> On 24/02/14 20:07, Zenaan Harkness wrote:
> > I'd include socat in the list, but perhaps it's command line options
> > are different? socat is my preferred network swiss army knife.
> >
> > A little different, but there are also netsed, netrw etc.
>
> And the excellent crypcat - but I just counted the ones with netcat in
> their name (in case the OP was, um, fussy about it), not necessarily
> their functionality. I don't know what the actual criteria for being
> "netcat" is, for me if it does the job and is in /etc/alternatives I'm
> happy.

There is also ncat, which comes in the nmap package and is described as
"a much-improved reimplementation of the venerable Netcat". This is what
the OP is apparently using. He might also have nc aliased to ncat.

I'd not previously come across the CAP_NET_BIND_SERVICE capability Pascal
Hambourg mentions; the OP could consider doing (as root)

setcap cap_net_bind_service=+ep /usr/bin/ncat

as a solution to his problem.



--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/2014022410...@copernicus.demon.co.uk

Jonathan Dowland

unread,
Feb 24, 2014, 12:30:02 PM2/24/14
to
On 24/02/2014 10:21, Brian wrote:
> the OP could consider doing (as root)
>
> setcap cap_net_bind_service=+ep /usr/bin/ncat
>
> as a solution to his problem.

If they do, they should be aware that would essentially permit any user
on the machine to bind to any port; since nc is a redirection system it
can be paired with any daemon or program.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/530B7F2D...@debian.org
0 new messages