- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: passed environment variables when using remsh
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2005 05:41 AM
02-22-2005 05:41 AM
hostA (user toad)> remsh hostB -l frog "echo what gets carried over from user toad for user frog?"
i know most are not ...like DISPLAY, SHELL, etc...
thx, marc
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2005 05:53 AM
02-22-2005 05:53 AM
Re: passed environment variables when using remsh
AFAIK it passes none.
Instead it will source the remote user's appropriate .profile .kshrc .cshrc - whatever is appropriate for that user's shell.
IF you need a specific env set up you'll need the remote command to source a file or run a script from the remotely called script.
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2005 06:02 AM
02-22-2005 06:02 AM
Re: passed environment variables when using remsh
If you want to have environment variables go to the other side, pass them as argument to a script.
Regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2005 06:35 AM
02-22-2005 06:35 AM
Re: passed environment variables when using remsh
remsh systemb env
remsh systemb set
The first shows exported variables and the second shows all variables. If you assume that nothing is setup when you use remsh, then you'll be safe. You'll have to run /etc/profile and .profile as part of your remsh command. Otherwise, you have to use rlogin to get the remote user's environment.
Carrying over local variables doesn't always make any sense (ie, SHELL is meaningless on the remote system unless it happens to match). DISPLAY makes sense but only telnet can transport a local variable (it happens to be TERM), remsh cannot. The important difference about remsh is that it is not a terminal process...it looks like one but if you try this:
remsh systemb who -muR
you'll get an error that who cannot identify the incoming terminal connection. So the key is to carry the DISPLAY variable in your command as in:
remsh systemb /usr/bin/X11/xclock -display $DISPLAY
Now this ASSUMES that DISPLAY is set to your IPaddr:0.0
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2005 07:00 AM
02-22-2005 07:00 AM
Re: passed environment variables when using remsh
Fred, thx because your comment made me just realize my mistake in posting my question! the issue is not with remsh but RLOGIN!
Bill, thx for the great feedback but again my mistake was that i meant RLOGIN not remsh
1) i am using rlogin ...not remsh as i wrongly stated earlier (sorry)
2) i am using the following command
rlogin hostB -l frog
3) the account frog on hostB is a "captive" account where everything is done in .profile and exits the account after .profile is done
4) Bill made a statement that is really what i mean ...i want to "transport a local variable" using rlogin to the .profile on the remote host, but i just do not know what local variables qualify!?! i just want to know if any qualify.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2005 07:16 AM
02-22-2005 07:16 AM
Re: passed environment variables when using remsh
It doesn't matter which of the r* services (remsh, rlogin, whatever) you use, the answer is the same. Nothing is taken from one machine to another.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2005 07:16 AM
02-22-2005 07:16 AM
Re: passed environment variables when using remsh
There is no alternative and passing DISPLAY for example from one machine to another won't work anyway.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2005 07:19 AM
02-22-2005 07:19 AM
Re: passed environment variables when using remsh
Well I should have been a little more explicit.
IF the default remote shell is /usr/bin/sh or /usr/bin/ksh THEN the following will run it
remsh hostb . .profile 2>&- \; rem_command
and set up the env before the command is executed. And of course that command can simply be a shell.
I really would look at setting up the env properly on the remote host using remsh rather then hoping you can pass env vars in rlogin because I just don't think it can be done.
Rgds,
Jeff
P.S. AFAIK - As Far As I Know
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2005 08:08 AM
02-22-2005 08:08 AM
SolutionHowever, that is not a good thing anymore. In old Unix days, terminal characteristics such as baud rate, parity, etc, needed to be propagated and each flavor of the rlogin or telnet daemon would use these to setup local behavior. Today, the underlying (and rather detailed) protocol handshake that you never see will handle this. But it leaves TERM defined at the remote system *prior* to running /etc/profile and .profile--this is not good. For instance, if you're on a Linux box and telnet/rlogin to HP-UX, /etc/profile will inherit TERM=linux, a bad thing because the terminfo library knows nothing about "linux" as a terminal (untic linux). And Windows may set something like TERM=ansi or whatever terminal emulator you are using on the PC.
So /etc/profile should be coded to NEVER use what it inherits for TERM. Instead, let ttytype probe your terminal automatically for the TERM variable. Get rid of the: if [ $TERM = something ] and replace all of that with:
exec $(ttytype -s)
Now your terminal setting on the remote side will be correct. ttytype will set TERM LINES and COLUMNS automatically. Run ttytype -s to see what it does.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2005 08:27 AM
02-22-2005 08:27 AM
Re: passed environment variables when using remsh
system would be the following:
$ remsh REMOTE_MACH_NAME 'xclock'
Error: Can't open display
$ remsh REMOTE_MACH_NAME 'DISPLAY=display_mach:0.0 xclock'
.. works like magic :-)
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2005 10:45 AM
02-22-2005 10:45 AM
Re: passed environment variables when using remsh
thx Patrick/Steve/Jeff for the feedback
thx Bill for the detail/explanation i was looking for about not only the sole env var. TERM that does qualify, but just that it is a best practice (as others stated above) to use the r* commands with needed env.s on the remote account itself