TCPSERV(1) (Nonessential Utilities) TCPSERV(1) NAME tcpserv - TCP/IP protocol based generic server SYNOPSIS tcpserv [-f max] [-d] [-t] [-u|-n] port [program [arguments]] DESCRIPTION This program acts as a remote server for any command specified on the command line. It binds the command to the port specified in the command line, and waits for a connection. When it recieves a connection, it runs a subprocess that provides full duplex communication between the program, which is attatched to a psuedo-tty, and the remote client (like telnet). The pseudo-tty is originally set using the parameters set by 'stty sane'. any additional settings must be done by the program. It can theoretically handle any number of connections, but realistically, it is limited by the number of processes allowed and the number of pseudo-tty's available. Once the connection is passed to the program, 'tcpserv' goes back to waiting in the background for a connection. It is a good idea to invoke 'tcpserv' in the background, ie: tcpserv port program arguments & Options: -t Allows tcpserv to support telnet connections. The telnet protocol handling is very simple as tcpserv is not meant to be a pure telnet client. -u Tells tcpserv to write a utmp entry for each connection. The utmp entry is written using the username of the person who invoked tcpserv. -d Tells tcpserv to run in daemon mode. In this mode, tcpserv breaks away from your terminal and runs in the background. It stays in the current working directory, and keeps the full environment it started with, while accepting tcp connections. -n Tells tcpserv to run a login(1) emulator on the port. This login feature will prompt for the login name, password, and look them up in the passwd file. It then performs all of the steps of login(1), except writing wtmp and lastlog entries. If no program is set to run, then the connection's user's login shell will be run. If tcpserv is running with superuser permissions, the program will run as though the logging in user had logged in via telnet, in their home directory, with their permissions, etc. If tcpserv is not running as superuser, the results are unpredictable; the program will run with the tcpserv invoker's permissions. -f max Sets 'max' as the maximum number of simultaneous connections tcpserv will allow. -x Sets debug mode. Standard error redirected to tcpserv's controlling terminal, not to the pseudo-tty. This is usefull to see what is happening to programs that just quit. In this debug mode, telnet negotiation is shown, and the hostname of each attempted connection is also shown. WARNING! tcpserv does NO inherent security checking. Any security must be provided by the program passed to tcpserv. The program that the remote server interacts with, inherits the environment the that the user who started tcpserv had. ie: if the person ran 'tcpserv 8000 sh &' and had as his prompt "Yes? ", anyone who telneted to that person's system and to port 8000 would connect to a shell that presented the prompt "Yes? " to them. It would also run with the priveleges and as a process of the person who invoked 'tcpserv'. (Unless that person was root, and the program on the command line used setuid() to set the user id to something else) NOTES The input from the remote program is passed transparently to the program under the pty. No protocol checking is done, and no out of band communcations are interpreted.