Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!spool.mu.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!clarkson!heron.qz.se!s1039 From: s1039@heron.qz.se (Lars Magnusson) Newsgroups: comp.unix.wizards Subject: Re: One solution to (Re: How do a login shell detect that it is "remote") Message-ID: <9103220942.AA28239@heron.qz.se> Date: 22 Mar 91 11:42:49 GMT References: <1991Mar20.154258.1439@resam.dk> Organization: QZ UniversitetsData AB - KOM conference system Lines: 77 In-Reply-To: <9103211956.AA11855@msri.org> In article <9103211956.AA11855@msri.org> you write: >In article <1991Mar20.154258.1439@resam.dk> andrew@resam.dk (Leif Andrew Rump) writes: .......... >>Well the problem boiled down because suddenly I found out that when I >>use rlogin to log in on a remote site, I get the path defined in the >>login scripts on the remote workstation and it is not possible to get >>the path from the workstation that I'm physical located at. That's >>logical because the workstation I rlogin into may be something almost >>but not entirely unlike the SunSparc I'm looking at! ........ >>HOW do I detect that I'm logged in from a remote site (I know that >>is cheating, but I need to put in the path again)? >> >>Leif Andrew Rump, AmbraSoft A/S, Stroedamvej 50, DK-2100 Copenhagen OE, Denmark ......... > > I have more or less the same problem. The additional difficulty I >have is that I some times use standard X11R4 and wish different binaries >for xterm etc. > ......... >You should rlogin to a remote host by doing > > > xnrsh remote_host xterm > >or ......... >Of course, you will need to set up .rhosts on machines so that you can >login w/o a passwd. And don't forget to pass Xauth infomation or use xhost >to add the remote_host to the access list. > > This is the most satisfaction solution I have found so far. Does >any body have any better ideas? > ........ > Rui - Tao Dong | (415) 237 - 7628 (H) An alternative, depending a bit on loginnames(ie. are several individuals usin tha same login) and X's functionality in an rlogin-situation, is the solution i'm presently are using to distinguis between consol-login and telnet-login ftom a PC to a Sparc WS. In .login I have following construction. ---------- .login ---------- set $PTYPE = `$HOME/bin/ptst` if ($PTYPE == 'p') then set term = vt100 else set term = sun endif -------- ------- ptst --------- ps -x | grep "\-csh" | awk '{print $2; exit }' | cut -c1 ----------------------- If your at consol the value is "c" as in console, otherwise it's "p" for ptty. I am only using it for setting up terminal, but if your not sharing som pseudo-anonymous login with other users, and Xterm on the local mashine does'n demand any special .loginshells you should be able to control the login enviroment in this way. I could have had different PATH defined, but since I don't need it .... The ptst should have been "who am i | cut -cX " insted, but both ps and who sends out som codes, that cut does not like on the SUN, at least I gave up. The ideal would have been to put it all in .login but also her it were problems. But as it is, it works just fine. -------------------------------------------------------------------------- Lars Magnusson ! EUNET : lmag@z.amu.se Dept. of Computing ! KOM : s1039 (s1039@heron.QZ.SE) AMU Jamtland ! Tel : + 46 63 14 56 00 Box 603 ! Fax : + 46 63 12 33 42 832 01 Froson (Ostersund) ! Sweden ! (Ostersund - candidate for Winter Olympics 1998) ==========================================================================