Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1377
  • Last Modified:

rlogin with adoption of $DISPLAY

I'm using Exceed for working with HP-UX.
When i logged in I have $DISPLAY set right.
When i do a rlogin to another machine my DISPLAY-variable is always unset. Is there a way to put $DISPLAY to the rlogin-command?

olka
0
olka
Asked:
olka
  • 4
  • 3
  • 2
  • +5
1 Solution
 
biraCommented:
0
 
biraCommented:
0
 
biraCommented:
rlogin wont accept to export DISPLAY variable, but you can
do this workaround

 Place the line "export DISPLAY=xxxxx" in the .profile of
the remote user that you want to rlogin.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
interiotCommented:
telnet will correctly propogate the DISPLAY environment variable, rlogin won't.

If typing in your password is too painful, you can still use rlogin, if you go to some extra trouble to get the DISPLAY parameter across.  On the remote side, you could have it default to a particular DISPLAY, if, for instance, you usually run your Exceed on the same windows box.  Or you could use 'expect' to transfer the data over for you (see http://www.uni-ulm.de/urz/Hard_Software/Dokumentationen/free_unix/expect/xrlogin).  Or a myriad of other hacks...
0
 
ahoffmannCommented:
> telnet will correctly propogate the DISPLAY environment variable, rlogin won't.

NO, or may be.
This behaves on the version of telnet, rlogin and the deamon accepting the connection on the remote host. For example on IRIX the environment variable REMOTEHOST is passed through and evaluated by the deamon.

There is no simple way to set $DISPLAY to the right value, especially when you're doing nested (r)logins.

If the host where you issue the rlogin/telnet command is also your display host (where the X-Server is running), you may compute the DISPLAY variable using the
    who am i
or
    tty
or
    w
command, or a combination of them.
But keep in mind that this is hard stuff, 'cause it depends on:
  - the shell you start rlogin ($SHELL)
  - the OS you start rlogin (uname -s)
  - sometimes the terminal where you start rlogin ($TERM)
  - the shell for the remote account
  - the OS on the remote host

A quick&dirty solution for most people is to wright the setting of the DISPLAY variable hardcoded in ~/.profile, ~/.login or adequate files, probably inside a switch detecting the host or os..
0
 
yuzhCommented:
Hi olka,

    You can put soemthing in your login start script to set your display,

eg .cshrc for csh/tcsh, .profile for .

   if you shell is csh/tcsh, then you add the following to your .cshrc
file:
   setenv DISPLAY `who am i | awk '{print $6}' | tr -d "()"`:0.0

   if your shell is sh/ksh/bask, you add the following to the .profile:
       export DISPLAY=`who am i | awk '{print $6}' | tr -d "()"`:0.0
   

   Cheers!

==========
yuzh

   

0
 
ahoffmannCommented:
>  setenv DISPLAY `who am i | awk '{print $6}' | tr -d "()"`:0.0

be careful using this (see my last comment), it does definitely not work on HP-UX, where you need to use
   who am i -R
AFAIK, on IRIX it also fails.
0
 
PaulSmirnoffCommented:
Offtopic:

It is highly suggested to avoid using rlogin and telnet
due to it's security weakness.

Wherever possible use SSH.

By the way, SSH provides SAFE X11 forwarding ...

Paul.
0
 
jahvaneCommented:
Don't know of anyway to do that (Don't think u can)I agree with other comments, edit your .profile with the DISPLAY=
0
 
olkaAuthor Commented:
I tried the command of yuzh. This works when i change the user with "su". So that's fine. But with rlogin the "who"-command only tells the name of the hostname and not the terminal (=Display) -Name.
I don't to code the DISPLAY=... line in .profile, because I'm not the only one who is working with the same Unix-Login in the project.
Nevertheless
thanks for the comments
olka
0
 
yuzhCommented:
Hi  olka,

    If you have tcsh install on your system,  you can get arround with
this problem.

   You can write a little script lets called it-- ckremote:

#!/bin/tcsh -f
#
      if ( $?REMOTEHOST ) then
           setenv MACHINE `echo ${REMOTEHOST} | cut -d. -f1`
           echo "${MACHINE}:0.0" > ~/.dsplay
      else
           setenv MACHINE `hostname`
           echo "${MACHINE}:0.0" > ~/.dsplay
      endif

#

if you are a sh/ksh/bash user, you can put the following in the .profile
#
# Auto set the DISPLAY for X server
#
    /home/yuzh/bin/ckremote
    DISPLAY=`cat ~/.dsplay`
    export DISPLAY

#========================================================

if you are runing tcsh/csh then put, the following in you .cshrc file
#
# Set the X server to the host where we logged in on
#
      if ( $?REMOTEHOST ) then
           setenv DISPLAY ${REMOTEHOST}:0.0
      else
           setenv DISPLAY :0.0
      endif

#========================================================

   That's what I did for the users in my systems, we are runing Solaris,

and it works fine, it also work for the X term on PC.

   Just give it a try.

   Good Luck!

Regards
   yuzh
0
 
ahoffmannCommented:
yuzh, again this does not work for nested (r)logins.
Best is to use ssh, which forwards the DISPLAY setting, in nested ssh also.
0
 
gmancusoCommented:
I'll add a "Me Too!" for the ssh suggestions.  I've fought with this for as long as I can remember, and ssh just makes it all go away.  Add to that the extra security you buy with encrypted network traffic, and there's really no reason not to use it.  Most competent Admins know about, and have already installed, ssh.  

Try www.openssh.org for unix clients (and servers).
I've found that puTTY is an excellent ssh client for Windows boxes.  The "released" version doesn't support X11 tunneling, but the beta version does.    Get it from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Good Luck
0
 
ahoffmannCommented:
.. and if you don't need ssh protocol version 2.0, you might use TeraTerm which forwards X (and any other port too). It also mimics the X11 behaviour for copy&paste, and I never have seen it crashing ...
For example from
http://www.zip.com.au/~roca/ttssh.html
http://hp.vector.co.jp/authors/VA002416/teraterm.html
0
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.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now