APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed


© September 2009 Anthony Lawrence

This article is from a FAQ concerning SCO operating systems. While some of the information may be applicable to any OS, or any Unix or Linux OS, it may be specific to SCO Xenix, Open There is lots of Linux, Mac OS X and general Unix info elsewhere on this site: Search this site is the best way to find anything.

How can I assign a user process to a specific pseudo tty (Old Sco Unix)?

This is an ancient post with no relevance to modern systems.

The desire to do this DOES pop up now and then on the web, but so far I've seen no answer for Linux (other than portservers, see below). If you know of anything, do let me know.

Conceptually, it shouldn't be hard: just attach to the desired tty. But I haven't seen anything that does this.

I'm going to bump this post to make it new in hopes of someone adding something useful.


A new "recon" command in OpenServer 5.0.6 allows this. See man recon+C

The new "recon" in 5.0.6 does allow you to specify at tty device- as long as something else isn't already using it. I'm not sure that's partucularly useful though.

recon -l -p /dev/ttyp43 /bin/sh

will attach you to ttyp43 if it's available. You'll execute .profile again (recon is smart enough not to run again if you had it in your .profile) and although "tty" now reports ttyp43, "who" still shows whatever you got originally.

You can also do this with terminal servers; see for example /Reviews/portserver.html

Bob Rasmussen of Anzio posted this in comp.unix.sco.misc:

On Tue, 15 Jan 2002, Joe wrote:

> Is there anyway to make sure a telnet client always gets the same TTY
> assignment when logging into a UNIX host? We have an application that
> assigns printers to hosts based on their TTY assignment. This is fine with
> terminals, but now we have PC's in place of terminals using TELNET, its
> giving the telnet sessions the next available TTY, thus screwing up printer
> issues.

I don't know of a way to to make sure a particular telnet client always gets
the same TTY device. But there are other ways to solve your problem. Here are
some possibilities to consider, dependent of course on the capabilities of
your telnet client. Keep in mind that in some cases you may want to have
multiple telnet sessions coming from one PC, and that may affect your choice
of methods. In no particular order:

1) ANSWERBACK: Most terminal models allow an answerback string to be
programmed in. The server can then query for this string. An advantage of this
approach is that it will work with dumb terminals as well as emulators.

2) ENVIRONMENT VARIABLES: An element of the telnet protocol (and also the SSH
protocol) is the passing of environment variables. You would configure your
telnet client with, for instance, "PRINTER=PRT25". This would get passed to
the shell session at login. Note that some telnet daemons disallow most
environment variables, except TERM, DISPLAY, and possibly PRINTER. I'm not
sure about SCO's approach here.

3) CREATIVE USE OF TERM: Because of restrictions just mentioned, some folks
have forced their telnet clients to send a terminal-type environment variable
containing both the terminal type info and also a location code. For instance,
"TERM=scoansi:PRT25". The .profile or other shell script then parses this,
resets the TERM variable, and also sets a location or printer variable.

4) IP ADDRESS: If your client PCs are using static IP addresses, you can
determine the IP address and base the printer assignment on that.

5) PASSTHROUGH PRINT: Send the print job back through the terminal session,
and from there to the printer. Yes, this can work quite well; we have hundreds
of people doing it, probably thousands.

6) FOLLOW-ME PRINTING: Print jobs are sent to either an LPD or a JetDirect
emulator at the same IP address as the telnet session is coming from; that is,
to the same PC. Our Print Wizard utility can do this.

7) ARBITRARY CLIENT RESPONSE: If you know at the host level that a particular
telnet client is running, there may be a way the host can query the client
using a proprietary feature. For instance, with Anzio (our telnet client), the
host can ask for the contents of a particular environment variable or
internal variable, such as the Windows machine name, the Windows login name,
or an arbitrary user-defined variable. This avoids restrictions imposed by the
telnet daemon.

....Bob Rasmussen,   President,   Rasmussen Software, Inc.

personal e-mail: ras@anzio.com
 company e-mail: rsi@anzio.com
          voice: (US) 503-624-0360 (9:00-6:00 Pacific Time)
            fax: (US) 503-624-0760
            web: https://www.anzio.com

Anzio makes VirtPort, which could solve this in some cases.

John Dubois said:

In 5.0.7, telnetd has a -r option that lets you `specify the pty or
pty range that it will use.  This lets you run a separate telnetd
on a different port that gets a specific pty.  If you log in
by connecting to that port, you will always get the same pty

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> (SCO Unix) How can I assign a user process to a specific pseudo tty?

More Articles by © Anthony Lawrence

Fri Sep 11 20:30:37 2009: 6886   badanov

There's always this for FreeBSD: (link)

Fri Sep 11 20:33:39 2009: 6887   TonyLawrence

That's great. Thanks for the link!

That has extra features too:

Any number of telnet(1) clients may connect to a single port.
Each client will see exactly the same output as well as being able to
send keystrokes simultaneously.

Mon Aug 23 13:01:57 2010: 8926   ChrisB


This will work in a 5.06/7 profile -

stty intr "^C" erase "^?"

while ( true )
if [ "$TTY" = "" ]
echo ""
echo " NOTE : Cashiers select appropriate location."
echo " Must be correct for ticket printer"
echo ""
echo ""
echo " Valid values are "
echo " 1) Cashier 1 "
echo " 2) Cashier 2 "
echo " 3) Cashier "
echo ""
echo " 0) Anyone else "
echo ""
echo -n " Enter the number that corresponds to your Station: "
read TTY
case $TTY in
1) TTY=/dev/tty1a71 ; break ;;
2) TTY=/dev/tty1a73 ; break ;;
3) TTY=/dev/tty1a72 ; break ;;
0) TTY="" ; break ;;
*) TTY="" ; break ;;

export TTY

Mon Aug 23 15:44:51 2010: 8928   TonyLawrence


You are misunderstanding. Your script is telling a script where you are located, what we are talking about here is forcing a login it to a specific tty. See "man recon" and discussion above.


Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

Yeah, it's obsolete, clunky, insecure and broken, but people still use this stuff (Tony Lawrence)



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode