utility to determine rlogin?
Jerry Peek
jerryp at cmx.npac.syr.edu
Sun Jun 5 22:46:44 AEST 1988
In article <204 at ge1cbx.UUCP> gerald at ge1cbx.UUCP (Gerald Aden) writes:
> Is there a utility that returns an indication as to whether or not
> I am remotely logged in. I want to put it in my .login file where
> I want to perform certain functions if I am remotely logged in. My
> home directory is NFS mounted on all the machines on our network.
You didn't say what OS you're using. And I don't know how it's configured.
But I can tell you how I did the same kind of thing on a 4.3BSD system. It
turned out to be really useful. Most of our terminals were connected to:
- a dataswitch (like Sytek, Develcon, etc.) or
- a network (for rlogin, telnet, etc.)
So, we couldn't make the same kinds of assumptions (like "ttyG3 is always a
vt100") that sites with hardwired terminals did.
First, we labeled all the entries in the /etc/ttys file to tell what sort of
device was hooked to each one. (Our /etc/ttys used to label all terminals as
"plugboard". We changed them to read "dw3", "develcon", "sytek", "network",
etc.) So, all the rlogin-able ports were labelled "network" in /etc/ttys.
Then, I wrote a shell script named "ttykind". It took a tty name on the
commandline (default: current terminal) and output the tty kind from the
/etc/ttys file. For example, let's say I'm remotely logged in on /dev/ttyp3,
and /etc/ttys shows it as a "network" tty. Running "ttykind" will give:
% ttykind
network
So, setting up my .login was easy. I put a test like this one in it:
switch ("`ttykind`")
case network:
# do stuff for network login
case xxx:
# do stuff for xxx login
default:
DISCLAIMERS: The /etc/ttys file is important; you shouldn't edit it without
thinking about what else will be affected. Also, on some non-4.3BSD systems,
there are two files named (I think) /etc/ttys and /etc/ttytype; they work in a
different way than the 4.3BSD /etc/ttys file. Finally, it's been quite a
while since I used that system; I hope I haven't forgotten any details.
--Jerry Peek, Northeast Parallel Architectures Center, Syracuse, NY 13244-1260
jerryp at cmx.npac.syr.edu
+1 315 423-4120
More information about the Comp.unix.questions
mailing list