rsh works on the ksh prompt but not in a shell script

rsh works on the ksh prompt but not in a shell script

Post by CompGe » Fri, 09 May 2003 15:26:52



Hi there,

 I am trying the foll rsh command from the shell script and it works
fine.

 rsh $rsh_node -l $rsh_user<enter>
 $rsh_password<enter>
 ls -la<enter>
 exit<enter>

  Now the above command works and shows me the listing as needed.
However, when i put the same into a script as follows :

 rsh $rsh_node -l $rsh_user << EOF
 $rsh_password<enter>
 ls -la<enter>
EOF

  Now this just gives me a "Connection Closed" statement and no output
at all.

  What am i to do ?

 
 
 

rsh works on the ksh prompt but not in a shell script

Post by Steve Greatbank » Fri, 09 May 2003 20:53:24


rsh is expecting the password input from stdin, but the shell script runs in
a tty.
Either put an entry into .rhosts (BAD), or use ssh (GOOD).
You are far better off not using the "r" commands at all...


Quote:> Hi there,

>  I am trying the foll rsh command from the shell script and it works
> fine.

>  rsh $rsh_node -l $rsh_user<enter>
>  $rsh_password<enter>
>  ls -la<enter>
>  exit<enter>

>   Now the above command works and shows me the listing as needed.
> However, when i put the same into a script as follows :

>  rsh $rsh_node -l $rsh_user << EOF
>  $rsh_password<enter>
>  ls -la<enter>
> EOF

>   Now this just gives me a "Connection Closed" statement and no output
> at all.

>   What am i to do ?


 
 
 

rsh works on the ksh prompt but not in a shell script

Post by Steve Nottingh » Fri, 09 May 2003 20:59:44



>  rsh $rsh_node -l $rsh_user << EOF
>  $rsh_password<enter>
>  ls -la<enter>
> EOF

>   Now this just gives me a "Connection Closed" statement and no output
> at all.

>   What am i to do ?

Read the man page for rsh :-)
Create a .rhosts file in the home directory of the user you want to
login as. The file containing the hostname and user allowed access
e.g.
local_node local_user

Steve

 
 
 

rsh works on the ksh prompt but not in a shell script

Post by CompGe » Sat, 10 May 2003 16:21:04


Thanx Steve,

After putting in the .rhosts file in the remote users home, now things
are working just fine.

Thanx a lot.

CompGeek.


> >  rsh $rsh_node -l $rsh_user << EOF
> >  $rsh_password<enter>
> >  ls -la<enter>
> > EOF

> >   Now this just gives me a "Connection Closed" statement and no output
> > at all.

> >   What am i to do ?

> Read the man page for rsh :-)
> Create a .rhosts file in the home directory of the user you want to
> login as. The file containing the hostname and user allowed access
> e.g.
> local_node local_user

> Steve

 
 
 

rsh works on the ksh prompt but not in a shell script

Post by Bob Mariot » Sun, 11 May 2003 11:12:14




Quote:>Hi there,

> I am trying the foll rsh command from the shell script and it works
>fine.

> rsh $rsh_node -l $rsh_user<enter>
> $rsh_password<enter>
> ls -la<enter>
> exit<enter>

>  Now the above command works and shows me the listing as needed.
>However, when i put the same into a script as follows :

> rsh $rsh_node -l $rsh_user << EOF
> $rsh_password<enter>
> ls -la<enter>
>EOF

>  Now this just gives me a "Connection Closed" statement and no output
>at all.

>  What am i to do ?

I too am trying to get rsh working from a Linux box to an AIX 5.1 box.
I've created an .rhosts file in the /home/username directory with the
format suggested by man rsh (i.e.: sourcehostname   username) but when
I try to rsh to the AIX box I receive the error "Permission is
denied".

Anyone ever able to resolve this?

 
 
 

rsh works on the ksh prompt but not in a shell script

Post by Jeffrey Ros » Tue, 13 May 2003 08:44:36



>I too am trying to get rsh working from a Linux box to an AIX 5.1 box.
>I've created an .rhosts file in the /home/username directory with the
>format suggested by man rsh (i.e.: sourcehostname   username) but when
>I try to rsh to the AIX box I receive the error "Permission is
>denied".

>Anyone ever able to resolve this?

I don't use 5.1 but have set up 4.3 to work with RH Linux 7.1.
The .rhosts file should have mode 600 and the owner of the file should be
set to the owner of that home directory, eg /home/fred/.rhosts with mode 600
(-rw-------) and owner fred.
The user ids should match between the machines in question.  Check column 3
in /etc passwd for this.
Connecting from AIX to Linux will probably require "rlogin" and "rsh"
entries to be added to /etc/securetty on Linux.
Keep at it, eventually the wall of resistance gives way!
Regards,
Jeffrey.
 
 
 

rsh works on the ksh prompt but not in a shell script

Post by Joerg Brueh » Tue, 13 May 2003 17:26:19


Hi!




                                ^^^^^                    ^^^^^^^^


> >[...]

> >  Now the above command works and shows me the listing as needed.
> >However, when i put the same into a script as follows :

> > rsh $rsh_node -l $rsh_user << EOF
> > $rsh_password<enter>
> > ls -la<enter>
> >EOF

> >  Now this just gives me a "Connection Closed" statement and no output
> >at all.

As a "freak" and "geek", you might know that "rsh" will never take
the password simply from standard input but rather insists on
getting it from a tty. The usual way out is the "expect" package.

Quote:

> I too am trying to get rsh working from a Linux box to an AIX 5.1 box.
> I've created an .rhosts file in the /home/username directory with the
> format suggested by man rsh (i.e.: sourcehostname   username) but when
> I try to rsh to the AIX box I receive the error "Permission is
> denied".

Works fine for me - client is a Linux on an Alpha processor
(SuSE 7.0 distribution, 2.2.16 kernel); server is AIX 5.1.
It was necessary to use the fully qualified client name,
including the domain (even though client and server are in the same):
    linux-pc.department.company.de   user

Similar holds for the "securettys" file needed on some Unix variants
(notably Tru64) for remote "root" login, here the line may need to
include the client's X server number:
    linux-pc.department.company.de:0

HTH,
Joerg Bruehe

--
Joerg Bruehe, SQL Datenbanksysteme GmbH, Berlin, Germany
     (speaking only for himself)

 
 
 

1. rsh problems when ksh is user shell (PATH not defined right)

Hi all,

My users here have a problem when trying to do some remote shells
and the shell is a ksh. Basically /etc/profile and $HOME/.profile
don't seem to be read when they do a rsh

Can someone tell me which setup files are read when a rsh is done
or which book will tell me that. There don't seem to be anything
about that in the man of ksh, rshd

Rick

--
Richard Lefebvre, Sys-admin, CERCA, (514)369-5224                "Don't Panic"
http://www.CERCA.UMontreal.CA/~rick/                                -- THGTTG

2. Q: Looking for a search engine/tool to provide a "Knowledge Base" or Call Center functions.

3. Using rsh (remote shell command) with $SHELL=ksh.

4. Galeon - one of the best webbrowsers available

5. Changing login prompt (NOT motd or shell prompt)

6. Apache compilation problems

7. prompt not returning after shell script

8. ftp problem through a linux gateway

9. Remote Shell - rsh Not Working

10. ksh script problem: pwd works differently for ksh then linux binary file

11. flexible prompt in shells via shell-script

12. Remote Shell - rsh Not Working

13. Shell Variables: Shell prompt OK, script, NO.