1752708 Members
5556 Online
108789 Solutions
New Discussion юеВ

passing args to rlogin

 
SOLVED
Go to solution
Tom Rosenfeld
Occasional Advisor

passing args to rlogin

I know that I can pass argument to login(1) and receive them in the enevironment variable $Ln. However, I havn't found how to do this via rlogin(1). rlogin does not seem to allow any args after the username.

Is there some way around this?

-tom
3 REPLIES 3
Shannon Petry
Honored Contributor

Re: passing args to rlogin

Nope, you can not do this with rlogin, but you could with remsh! Rlogin remember initializes the users variables to the system defaults just as telnet does. This means the .login, .cshrc, .kshrc, .profile, etc.. are processed, but not variables from the remote.

Perhaps you could setup your home dirs as networked, and put all environment vars in those login files, or do what you need within remote shell instead of remote login when requiring the passing of variables.

Regards,
Shannon
Microsoft. When do you want a virus today?
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: passing args to rlogin

Hi Tom,

No, not directly but how about this:

create a textfile (remenv.sh) on the client end; e.g. :

myvar1=111
myvar2=222
myvar3=333
export myvar1 myvar2 myvar
#no exit statement !!!

Before logging in user user1 to remote_host do an rcp -p remenv.sh remote_host:/home/user1/

The .profile of remenv.sh should be modified:

REMENV=remenv.sh
if [-r ${REMENV} -a -f ${REMENV} ]
then
. ${REMENV}
rm -f ${REMENV} # it's done it job; don't need it
fi

Then do rlogin remote_host -l user1 and when user1's .profile is read, the env vars are there and exported for use.


Not as easy as env vars in login but it should work.

Food for thought, Clay
If it ain't broke, I can fix that.
Tom Rosenfeld
Occasional Advisor

Re: passing args to rlogin

Clay,
Great idea! I suppose I can make an alias to 'rlogin' that will automate the 'rcp'.

I actually have many people logging into a shared account. I am a little concerned of their 'rcp' colliding. I suppose I can add some kind of lock file.

Thanks,
-tom