Solved

Can I change or define ttyp0?

Posted on 2002-04-17
6
382 Views
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
192.168.0.1 scosysv scosysv
192.168.0.2 netterm1

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

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?
0
Comment
Question by:Pardu
6 Comments
 
LVL 40

Expert Comment

by:jlevie
Comment Utility
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.
0
 
LVL 1

Accepted Solution

by:
stan64 earned 200 total points
Comment Utility
We have an application that is a similar situation.
All users log in to unix (sco 3.2.5.0.[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" ]
then
    host_name=`who -mx|cut -c38-80|cut -f 1 -d\.`
    if [ "$host_name" = "" ]      # serial or console login
    then
        host_name=`uname -n`
    fi
else
    host_name=`uname -n`
fi
server_host_name=`uname -n`

set `who am i|cut -c16-16` WHERELOG
WHERELOG="$1"
set `who am i` NOLOGIN
WHOLOG="$1"
TTYLINE="$2"

###############################################

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

Hope this helps
stan


0
 

Author Comment

by:Pardu
Comment Utility
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.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Expert Comment

by:stan64
Comment Utility
Pardu,
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

0
 

Author Comment

by:Pardu
Comment Utility
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.
0
 
LVL 20

Expert Comment

by:jmcg
Comment Utility
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.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now