Can I change or define ttyp0?

I posted this on and have not gotten much luck in answers and am trying to post it here now.

Can I change or define the ttyp0 address a particular computer logs into? I want to be able to telnet into an SCO OpenServer 5 system and need a defined login. ie. /dev/tty01, /dev/tty1a, /dev/ttyS00, /dev/nt101

I can use NetTerminal software for the Boundless NetTerminals and get /dev/nt101 - nt112 for all 12 screens on a NetTerminal. I could also get /dev/nt201 - nt212 for the second terminal and so on.

With my application I need to be able to set options using the /dev/ttyXX. Of course ttyp0 could be used on any terminal at any time.

I hope this is clear enough and understandable.

On the console I have tty01, tty02, tty03 through tty12. Each screen is able to have parameters for printing assigned by the port name. I could set up screen tty01 to print to a printer on /dev/lp0 and on screen tty02 I could set it up to print on a printer on /dev/lp1 or /dev/tty1a or whatever printer I need to. 2 files are saved in the home directory. tty01.cnf and tty01.xd.

Now if I have 2 computers ran through IP I will have ttyp0 through as many screens as I login in on. If I have one computer on the 2nd floor and one computer on the third floor I would need to assign each computer to print on the printers on the second floor and third floor with each computer. The problem is that I could log in on the computer on the second floor and get /dev/ttyp0 one time and /dev/ttyp1 the next. If I set the parameters for the session to print on the second floor it would run fine until the computer on the third floor logs in on /dev/ttyp0 or /dev/ttyp1.

If I could set the computer that is on the second floor to always log in on /dev/ttyp0 and the computer on the third floor to log in on /dev/ttyp1 it would work fine. I would like to be able to use multiple telnet sessions as well. If I could set the second floor computer to /dev/ttyp0 through /dev/ttyp12 and the computer on the third floor to /dev/ttyp13 to /dev/ttyp24 that would be nice.

I have read something about a login support program. Is this what I need or is it just a script I write? Boundless makes the Net Terminals I can use. They have software I can install to make the screens come up as /dev/nt101, /dev/nt102 through /dev/nt112. Net Terminal #1 screen 1 - 12. When the login comes up I get something similar to this:

SCO OpenServer(TM) Release 5 (scosysv) (ttyp0)

Net Terminal login on /dev/nt101:

I have these entries in my/etc/hosts and /etc/netterms files:

/etc/hosts file scosysv scosysv netterm1

/etc/netterms file
# Symbolic names of NetTerminals from /etc/hosts.

I only have one login and each user uses it. I have no multple user accounts. If I could set it up so each IP address has it's own login that would be great. Maybe even If I could use the computer name on the computer. I have been useing Anzio Lite for my telnet session. Could there be another program that may do what I am looking for?
Who is Participating?
stan64Connect With a Mentor Commented:
We have an application that is a similar situation.
All users log in to unix (sco[4-5]) as the same user.  Station capabilities and options are determined by the tty device if it is a serial connection or host_name (resolved ip address).  here is a snippet of how we do it:

unix_release=`uname -X|grep Release|cut -c11-15`
if [ $unix_release = "3.2v5" ]
    host_name=`who -mx|cut -c38-80|cut -f 1 -d\.`
    if [ "$host_name" = "" ]      # serial or console login
        host_name=`uname -n`
    host_name=`uname -n`
server_host_name=`uname -n`

set `who am i|cut -c16-16` WHERELOG
set `who am i` NOLOGIN


you can now test if host_name = server_host_name and then set things appropriately.

Hope this helps

To the best of my knowledge there isn't any way to control what pseudo device a remote login uses on any flavor of Unix. The psuedo terminals are allocated by the system on a first come, first served basis.

The solution in a case like this is to arrainge to print, or whatever, to the contents of an environment variable. That variable would be set for each login from the shell init script based on some session critera, like IP address or client nodename. For example, a number of Unixen will print to the system default printer or to the printer defined by the PRINTER env variable. In a case like that one would set the variable to point to the appropriate printer based, perhaps, on the IP of the remote client.
ParduAuthor Commented:
Ok, I am not that advanced. Where would this go? My .profile?

Well I tried it in my .profile.

Can I use "who am i" and be able to see anything other that /dev/ttyp0?

That is what I am trying to change. Maybe it could say /dev/ttyp0 and the hostname variable

I was able to get my hostnames to come up doing set and could see either server or jon for my other computers. Could I get "who am i" to say /dev/ttyjon or /dev/ttyp0jon?

I can keep trying things.
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Yes, use it in the .profile but this is just a starting point.  It all depends on how you are going to use it. If you want to set certain things depending on where you are logged in from then create an environment variable to hold the value of your location. then test whether host_name is equal to server_host_name if it is then set the value of this location variable to the actual device name otherwise use the value of host_name.  just remember to export the variables that you are going to need in your application.  My suggestion is to use this location variable just as tag or index on what you want to set up for the session. Do not try and use it as a direct device name as this will only cause you problems in the future.

who am i - is an relatively standard part of *nix however its output varies alot.
who -mx - is an sco specific

ParduAuthor Commented:
Ok, I thought about it afterwards. I can check to see if the software vendor can modify their program. Maybe if the tty variable is equal to ttypXX then they can use the host name for the parameters that need to be saved.
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: stan64 {http:#6962655}

Please leave any comments here within the next four days.

EE Cleanup Volunteer
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.