.TH LISTEN 8
.SH NAME
listen, listen1, tcp7, tcp9, tcp19, tcp21, tcp22, tcp23, tcp25, tcp53, tcp110, tcp113, tcp143, tcp513, tcp515, tcp564, tcp565, tcp567, tcp993, tcp995, tcp17007, tcp17009, tcp17010, tcp17013 \- listen for calls on a network device
.SH SYNOPSIS
.B aux/listen
[
.B -q
]
[
.B -d
.IR srvdir
]
[
.B -t
.IR trustsrvdir
]
[
.B -n
.IR namespace
]
[
.I net
]
.PP
.B aux/listen1
[
.B -tv
]
.I addr
.I cmd
[
.I args ...
]
.SH DESCRIPTION
.I Listen
listens for and invokes services in response to incoming network calls.
.I Net
is the network protocol on which to listen, by default
.BR /net/tcp .
Services are executable, non-empty files in
.I srvdir
or
.IR trustsrvdir .
If neither
.I srvdir
nor
.I trustsrvdir
is given,
.I listen
looks for executable files in
.BR /bin/service .
Services found in
.I srvdir
are executed as user
.BR none ;
services found in
.I trustsrvdir
are executed as the user who started
.IR listen .
When changing user to
.BR none ,
a new name space is created, either that defined in
.BR /lib/namespace ,
or in the file
.I namespace
given to
.BR -n .
Option
.B -q
suppresses affirmative logging to standard output.
.PP
Service names concatenate the network protocol with the number of the service port.
For example,
an inbound call on the
.SM TCP
network for port 565 executes service
.BR tcp565 .
.PP
The following services are available in
.BR /bin/service :
.TF \ tcp0000
.TP
.B tcp7
Echo any bytes received (bit mirror).
.TP
.B tcp9
Consume any bytes received (bit bucket).
.TP
.B tcp19
Chargen service.
.TP
.B tcp21
.SM FTP
daemon.
.TP
.B tcp23
Telnet terminal connection.
.TP
.B tcp25
.SM SMTP
mail delivery.
.TP
.B tcp53
.SM TCP
port for
.SM DNS.
.TP
.B tcp113
Ident port (always reports
.BR none ).
.TP
.B tcp143
.SM IMAP4rev1
port.
.TP
.B tcp513
Rlogin terminal connection.
.TP
.B tcp515
.SM LP
daemon; see
.IR lp (8).
.TP
.B tcp564
Serve a piece of the name space using the Plan 9 file system protocol,
with authentication via
.I Tauth
(in
.IR attach (5)),
no encryption,
and multiplexing multiple users on a single connection.
(Used by
.IR srv (4),
and also by Unix systems to see Plan 9 files.)
.TP
.B tcp565
Echo the destination address and sysname, along with the source address and port, of each incoming call.
.TP
.B tcp993
Secure
.SM IMAP4rev1
port.
.TP
.B tcp17007
Serve a piece of the name space using the Plan 9 file system protocol, with authentication at the start, optional SSL encryption, and no multiplexing of users (typically used by
.IR cpu (1)
and
.IR import (4)).
Not usable by user
.BR none .
.TP
.B tcp17009
.I Rx
remote execution
(See
.IR con (1)).
.TP
.B tcp17010
Server for
.IR cpu (1)
command.
.TP
.B tcp17013
Server for old
.IR cpu (1)
command for compatibility with old clients.
.PD
.PP
The following services are available in
.BR /bin/service.auth :
.TF \ tcp0000
.TP
.B tcp22
`Secure shell' encrypted terminal connection or file transfer (see
.I sshserve
in
.IR ssh (1)).
.TP
.B tcp110
.SM POP3
port.
.TP
.B tcp567
Plan 9 authentication-ticket service.
.TP
.B tcp995
Secure
.SM POP3
port.
.PD
.PP
.I Listen1
is a lightweight listener intended for personal use,
modeled from Inferno's
.\" write out this way so automatic programs
.\" don't try to make it into a real man page reference.
\fIlisten\fR(1).
It announces on
.I addr
(of the form described in
.IR dial (2)),
and on each incoming connection invokes the program
.I cmd
with any given options and arguments
.IR args .
The network directory is passed in the environment variable
.BR $net .
Option
.B -t
causes
.I listen1
to run as the invoking user; the default
is to become
.B none
before listening.
Option
.B -v
causes verbose logging to standard output.
See
.B /rc/bin/tlssrvtunnel
for an example.
.SH FILES
.TF /env/sysname
.TP
.B /net/tcp
by convention,
.SM TCP
device bind point
.SH SOURCE
.B /rc/bin/service
.br
.B /rc/bin/service.auth
.br
.B /sys/src/cmd/aux
.SH "SEE ALSO"
.IR attach (5),
.IR authsrv (6),
.IR con (1),
.IR cpu (1),
.IR dial (2),
.IR import (4),
.IR ipserv (8),
.IR lp (8),
.IR pop3 (8),
.IR smtp (8),
.IR srv (4),
.IR ssh (1),
.IR tlssrv (8)
|