Can I change or define ttyp0?

Posted on 2002-04-17
Medium Priority
Last Modified: 2010-05-18
I posted this on unix.com 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?
Question by:Pardu
LVL 40

Expert Comment

ID: 6950385
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.

Accepted Solution

stan64 earned 800 total points
ID: 6962655
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


Author Comment

ID: 6964128
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.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Expert Comment

ID: 6965584
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


Author Comment

ID: 6966015
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.
LVL 20

Expert Comment

ID: 10329563
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question