Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

rlogin with adoption of $DISPLAY

Posted on 2001-07-11
14
Medium Priority
?
1,293 Views
Last Modified: 2013-12-06
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
Comment
Question by:olka
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +5
14 Comments
 
LVL 6

Expert Comment

by:bira
ID: 6273124
0
 
LVL 6

Expert Comment

by:bira
ID: 6273517
0
 
LVL 6

Expert Comment

by:bira
ID: 6273526
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
Independent Software Vendors: 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!

 
LVL 3

Expert Comment

by:interiot
ID: 6273536
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6273607
> 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
 
LVL 38

Accepted Solution

by:
yuzh earned 100 total points
ID: 6275436
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6276162
>  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
 

Expert Comment

by:PaulSmirnoff
ID: 6286018
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
 

Expert Comment

by:jahvane
ID: 6299076
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
 

Author Comment

by:olka
ID: 6301086
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
 
LVL 38

Expert Comment

by:yuzh
ID: 6301141
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6301754
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
 

Expert Comment

by:gmancuso
ID: 6342083
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6342393
.. 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

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

721 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