Operating System - HP-UX
1753360 Members
4846 Online
108792 Solutions
New Discussion юеВ

How can I export local environment to a remote session ?

 
SOLVED
Go to solution
Lothar Krueler
Regular Advisor

How can I export local environment to a remote session ?

In our environment we use a session manager (screen)on one node and do remote logins to other nodes. Sometimes there are several logins from several terminals by the same userid. I configured vim for using configurationfiles regarding to username and terminal. This works fine using only local logins, because i determine the terminal useing who -u while login. In the case of remotelogin i only get the name of the node initiating the remote-login. (eg. node1 local, node2 remote, who -u on node1 returns the terminal, who -u node2 returns node1)
I also set $STATION to the terminalname while login, it would help, if i could export this to the remote session.
Thanks in advance
Lothar
Wissen macht zaghaft, Dummheit kann alles!
6 REPLIES 6
Santosh Nair_1
Honored Contributor

Re: How can I export local environment to a remote session ?

I believe the tty command will return your present tty. I'm not sure if that's what you're looking for though.

-Santosh
Life is what's happening while you're busy making other plans
Lothar Krueler
Regular Advisor

Re: How can I export local environment to a remote session ?

Thanks Santosh,
tty is a good idea, but tomorrow my tty assigned to the same PC / Terminal will be another than today. I'm looking for a way to make the remote host know the users PC.

Regards Lothar
Wissen macht zaghaft, Dummheit kann alles!
harry d brown jr
Honored Contributor
Solution

Re: How can I export local environment to a remote session ?


You could push the variables you want into a file on eht elocal machine then when the user logs in to the remote machine the profile could attempt to "grab" (rcp?)that file and source it in.

echo $STATION > ./myXtraprofile

rlogin remote

remote server profile grabs file and sources it in.


live free or die
harry
Live Free or Die
Lothar Krueler
Regular Advisor

Re: How can I export local environment to a remote session ?

Thanks Harry,
very good idea for creating an xrlogin shellscript. So I can export whatever i want to the remote host. After the rcp there should be run a remsh rm command for the file on the local host
Regards Lothar
Wissen macht zaghaft, Dummheit kann alles!
Jordan Bean
Honored Contributor

Re: How can I export local environment to a remote session ?


During login, this will provide most of the information you need:

$ who -mu | read username terminal month day time idle pid host

The other piece of information you seek is the station identifier from the remote client. Try passing this along as part of the terminal emulation name:

From node1:
$ TERM=${TERM}:${STATION} rlogin node2

On node2, in /etc/profile, before it tries to guess the emulation:

STATION=${TERM#*:}
TERM=${TERM%:*}
export TERM STATION

This can also work using the answerback feature available with most terminal emulators that do both telnet and rlogin.
Lothar Krueler
Regular Advisor

Re: How can I export local environment to a remote session ?

Thanks Jordan,
I did the scripting with Harry's hint yesterday and it works fine.
Now i tested your solution and it works fine too, and it's much easier to handle because it don't need rcp or remsh. I didn't knew the feature of setting a variable in a shell-commandline.
Thanks again
Lothar
Wissen macht zaghaft, Dummheit kann alles!