Operating System - HP-UX
1832968 Members
2566 Online
110048 Solutions
New Discussion

Re: Need help for solving rexec asking for password.

 
SOLVED
Go to solution
violin_1
Advisor

Need help for solving rexec asking for password.

Hello all,

I'm testing rsh or rexec command : (HPUX 11.11)

A server rlogin to B server => it's OK!
[gbm5:/] #rlogin gbm1
[gbm1:/] #
[gbm1:/] #
logout
Connection closed.
[gbm5:/] #

B server test shell script:
[gbm1:/] #date
Thu Aug 26 20:19:07 EAT 2004
[gbm1:/] #cat a.sh
#! /bin/sh
date >> /a.txt
[gbm1:/] #a.sh
[gbm1:/] #cat a.txt
Thu Aug 26 20:18:59 EAT 2004
Thu Aug 26 20:19:13 EAT 2004
[gbm1:/] #

A server test for remote executing:
if I don't enter root password , it won't work:

[gbm5:/] #rexec gbm1 -l root /a.sh
Password (gbm1:root):
rexecd: Login incorrect.
You have mail in /var/mail/root
[gbm5:/] #

else Bingo!
[gbm5:/] #rexec gbm1 -l root /a.sh
Password (gbm1:root):
[gbm5:/] #

[gbm1:/] #cat a.txt
Thu Aug 26 20:18:59 EAT 2004
Thu Aug 26 20:19:13 EAT 2004
Thu Aug 26 20:21:49 EAT 2004
[gbm1:/] #

A server(gbm5) , root .rhosts:
[gbm5:/] #cat .rhosts
gbm1 root
[gbm5:/] #

B server(gbm1) , root .rhosts:
[gbm1:/] #cat .rhosts
gbm5 root
[gbm1:/] #

How could I exec a.sh at A server(gbm5)?
Even I tried rsh at A , and still failed:

[gbm5:/] #rsh gbm1:/a.sh
rsh: gbm1:/a.sh: The operation is not allowed in a restricted shell.
[gbm5:/] #


Need helps , appreicate for any suggestions.
Thanks.

Violin.
violin@gbm.com.tw
7 REPLIES 7
Carlo Corthouts
Frequent Advisor
Solution

Re: Need help for solving rexec asking for password.

Hi Violin,

Is the .rhosts file set on the other machine?
Check in the ~HOME directory of the user used to execute the shell.

Regards,


Carlo
Pete Randall
Outstanding Contributor

Re: Need help for solving rexec asking for password.

First, where are the .rhosts files located? The need to be in roots home directory on each of the servers. Double check root's home directory in the password file to make sure the .rhosts files are in the proper location.

Second, there's no such thing as rsh in hp-ux - it's remsh.


Pete

Pete
violin_1
Advisor

Re: Need help for solving rexec asking for password.

Yes , both A , B server exists .rhosts at $HOME directory:

A server:
[gbm5:/] #cd $HOME
[gbm5:/] #pwd
/
[gbm5:/] #cat .rhosts
gbm1 root
[gbm5:/] #


B server:
[gbm1:/] #cd $HOME
[gbm1:/] #pwd
/
[gbm1:/] #cat .rhosts
gbm5 root
[gbm1:/] #


And rlogin or rcp commands are testing normally between A and B.

Thanks

Violin.
Suresh Pai
Advisor

Re: Need help for solving rexec asking for password.

As Pete mentioned, you need to use remsh instead of rexec, if you dont want to manually enter the password.

rsh is the restricted shell in HP-UX (and is not associated with the r-cmd suite).

rexec uses the rexecd server whereas remsh uses the remshd server. rexec uses a different user-authentication mechanism than the r-cmd suite.
violin_1
Advisor

Re: Need help for solving rexec asking for password.

Yes, Bingo , Thanks so much!
Bill Hassell
Honored Contributor

Re: Need help for solving rexec asking for password.

Just to elaborate on rexec: it is very different than rlogin/remsh/rcp. In the 3 'r' commands, the remote system validates the request with a .rhost file (or the more global hosts.equiv file). But for rexec, the remote system never needs any modification. Instead, a local file (.netrc) is used. This file is used for both ftp and rexec and contains 3 keywords: machine login password. After each keyword is the actual data so .netrc might have:

machine yoda login blh password 123abc

and now I could type: rexec yoda date
and I would get the date back, similar to remsh. The difference is that .netrc is on the local machine *and* it contains plaintext login/password information. This file will silently fail to work if the permissions are not 600, not in the user's $HOME directory or not owned by the user. For a highly secured management server, rexec is slightly better than remsh/rlogin. But the preferred remote managment tool is ssh.


Bill Hassell, sysadmin
violin_1
Advisor

Re: Need help for solving rexec asking for password.

It's my misunderstanding for rexec ,
I'll read it more clearly.