Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using RCP Command

Status
Not open for further replies.

KOG

MIS
Jan 31, 2002
303
GB
Hi Folks,

I am trying to create a scheduled script where I create a dump file overnight and run the rcp command to transfer it from one server to another.

Testing it on 43P to another server for development use only, I ran it using root and for some reason I have been denied access?

# rcp dan_test.txt blbrs580:/home/dan_test.txt
rshd: 0826-813 Permission is denied.

Can anyone explain why?

I have updated the hostname and IP address for both servers on both /etc/hosts file.

Is there anything I should do before running rcp command?

Thanking you all in advance.

Regards

Katherine
 
Katherine,

Log as the user you are rcp'ing as:

cd $HOME

Check for a .rhosts file ensure that the permissions are 600.

Add in the hostname of the server you are connecting from.

Best of luck PSD
IBM Certified Specialist - AIX V4.3 Systems Support
IBM Certified Specialist - AIX V4 HACMP
 
HI PSD

I am a bit confused here, where do I find .rhosts file? It is not in /etc directory. I have amended the hosts file.

I am using AIX 4.3.3 and the user I am using for rcping is root (dont know if that is ideal).

Cheers & Many thanks for your immediate response.

Katherine
 
The .rhosts is in the root (home) directory for the user who is doing the rcp -- in this case user root. So .rhosts would be in /. It is not there by default. You have to create it. And be sure to change the mode as PSD said to 600 or it won't work.
 
You need at least of the following set:

The local host needs to be included in the remote hosts's /etc/hosts.equiv file and the remote user in NOT the root users

OR

The local host and user name is included in a $HOME/.rhosts file on the remote user account.

Another way is to use rsync ( That has worked great for me in the past with Orca related projects.
 
Hi folks,

I dont know why it still would not grant me the privilege to run rcp command

# rcp dan_test.txt oracle@blbrs580:/home/dan_test.txt
rshd: 0826-813 Permission is denied.
# ls -l
total 19
-rw-r--r-- 1 oracle oinstall 146 04 Feb 15:32 dan_test.txt
-rw-r--r-- 1 oracle oinstall 161 06 Nov 15:18 insert_gateway2.sql
-rw-r--r-- 1 oracle oinstall 585 06 Nov 15:06 insert_gateway.sql
-rwxr----- 1 oracle oinstall 542 26 Jun 2002 .profile
-rw------- 1 oracle oinstall 48 04 Feb 19:20 rhosts
-rw------- 1 oracle oinstall 2952 05 Feb 09:52 .sh_history
-rw-r--r-- 1 oracle oinstall 1857 16 Dec 15:11 smit.log
-rw-r--r-- 1 oracle oinstall 65 16 Dec 15:11 smit.script
-rw-r--r-- 1 oracle oinstall 449 06 Nov 15:07 update_gateway.sql
#

I have updated the hosts, hosts.equiv file under /etc and chmodded the rhosts to 600 for both root and oracle user. And both still would not work.

Any idea why?

Thanking you all in advance.

Regards

Katherine
 
It's possible that this is failing because you are root trying to rcp oracle owned files. You could try to su and run the command:

su - oracle -c "rcp dan_test.txt \ oracle@blbrs580:/home/dan_test.txt"

Hope that helps.
 
Hi

Tried that and no luck, so sorry and I feel so guilty abt bothering u all.

# su - oracle -c "rcp dan_test.txt \ oracle@blbrs580:/home/dan_test.txt"
rcp: invalid user name oracle

$ rcp dan_test.txt \ oracle@blbrs580:/home/dan_test.txt
rcp: invalid user name oracle
$ rcp dan_test.txt root@blbrs580:/home/dan_test.txt
rshd: 0826-813 Permission is denied.
$ rcp dan_test.txt \ root@blbrs580:/home/dan_test.txt
rcp: invalid user name root

Should I add oracle user somewhere?

Cheers and thanking you all in advance.

Katherine
 
Katherine,

Post up the following:

grep "rshd" /etc/inetd.conf (from both nodes)

log in as the user you are trying to set up to rcp:

Post the output of this on both nodes.

cd $HOME

post up :

pwd

ls -l .rhosts

cat .rhosts PSD
IBM Certified Specialist - AIX V4.3 Systems Support
IBM Certified Specialist - AIX V4 HACMP
 
Hello PSD

Many thanks for your response.

Heres the output from one server (eib-srv0)

$ rcp dan_test.txt \ oracle@blbrs580:/home/dan_test.txt
rcp: invalid user name oracle
$ grep "rshd" /etc/inetd.conf
shell stream tcp6 nowait root /usr/sbin/rshd rshd
kshell stream tcp nowait root /usr/sbin/krshd krshd
$ cd $HOME
$ ls -l .rhosts
-rw-r--r-- 1 oracle oinstall 24 05 Feb 14:58 .rhosts
$ cat .rhosts
eib-srv0 130.1.103.2

Outputs from the other server 2 (blbrs580)


$ grep "rshd" /etc/inetd.conf
shell stream tcp6 nowait root /usr/sbin/rshd rshd
kshell stream tcp nowait root /usr/sbin/krshd krshd
$ cd $HOME
$ ls -l .rhosts
-rw-r--r-- 1 oracle oinstall 22 05 Feb 08:59 .rhosts
$ cat .rhosts
blbrs580 130.1.103.3


I had to delete the old file rhost and create one called .rhosts instead.

Ran the command again and got this error message;
$ rcp dan_test.txt \ oracle@blbrs580:/home/dan_test.txt
rcp: invalid user name oracle

Cheers & many thanks for your help

Katherine



 
I had put the "\" only to get to a new line. Omit that from the command, what I mean is, run:

rcp dan_test.txt oracle@blbrs580:/home/dan_test.txt

I know that seems picky, but it sounds like it is choking on the "\".

Good luck...
 
Hi hungdaemon

I still got an error message regarding to 'permission'?

$ rcp dan_test.txt oracle@blbrs580:/home/dan_test.txt
rshd: 0826-813 Permission is denied.

Can't think of what else to do?

Cheers

Katherine
 
Run it with "su":

su - oracle -c "rcp dan_test.txt oracle@blbrs580:/home/dan_test.txt"
 
But make sure that the user "oracle" has an .rhosts file as well it's HOME directory.
 
Oracle has .rhosts in its own home directory

$ pwd
/home/oracle
$ ls -la
total 12
drwxr-xr-x 2 oracle oinstall 512 05 Feb 14:55 .
drwxr-xr-x 5 bin bin 512 14 Oct 10:10 ..
-rw-r--r-- 1 oracle oinstall 146 04 Feb 15:32 dan_test.txt
-rw-r--r-- 1 oracle oinstall 161 06 Nov 15:18 insert_gateway2.sql
-rw-r--r-- 1 oracle oinstall 585 06 Nov 15:06 insert_gateway.sql
-rwxr----- 1 oracle oinstall 542 26 Jun 2002 .profile
-rw-r--r-- 1 oracle oinstall 24 05 Feb 14:58 .rhosts
-rw------- 1 oracle oinstall 656 05 Feb 15:50 .sh_history
-rw-r--r-- 1 oracle oinstall 0 05 Feb 10:12 smit.log
-rw-r--r-- 1 oracle oinstall 0 05 Feb 10:12 smit.script
-rw-r--r-- 1 oracle oinstall 449 06 Nov 15:07 update_gateway.sql
$ who am i
oracle pts/1 05 Feb 14:05 (130.1.4.18)
$

That is what is so confusing?
 
Katherine,

The .rhosts files on both nodes needs chmoding to 600:

chmod 600 .rhosts

Then add in on server server (eib-srv0)

blbrs580 oracle

Then add in on server (blbrs580)

eib-srv0 oracle

Save the files and

su - oracle

rsh blbrs580 "df -k"

Let me know if you have more problems
PSD
IBM Certified Specialist - AIX V4.3 Systems Support
IBM Certified Specialist - AIX V4 HACMP
 
Hi PSD,

Still have probs

# su - oracle
$ rsh blbrs580 "df -k"
rshd: 0826-813 Permission is denied.
$

I updated .rhosts on both root and oracle home directory with blbrs580 oracle. And applied the same task on the other server too.

Cheers

Katherine
 
Hi

It works only if I use ROOT user.

On eib-srv0 server, where I wish to transfer the file, the .rhosts on root home directory contains the following

eib-srv0 oracle

I removed .rhosts from oracle home directory and the command rsh blbrs580 "df -k" works.

BUT when I tried to transfer the dan_test.txt file to blbrs580 using oracle as a user, it failed. It only works if I use root as the user.

On blbrs580, there is .rhosts file on both root and oracle user, both containing the following info

eib-srv0 oracle

Any idea why it only works for root user not oracle?

Thanking you all in advance.

Cheers

Katherine
 
Katherine,

Did you make sure that the permissions of .rhosts in the oracle users home directory are 600?? If you did not the file will be ignored it has to have no other permissions other than the user of the file. it should be:

rw- --- ---

If that does not fix the problem change the oracle users .rhost file to just reflect the other server name i.e.
on server (eib-srv0)

blbrs580

and on blbrs580 to

eib-srv0

Afterwards post up the output of :

Katherine,

Post up the following:

grep "rshd" /etc/inetd.conf (from both nodes)

log in as the user you are trying to set up to rcp i.e. oracle:

Post the output of this on both nodes.

cd $HOME

post up :

pwd

ls -l .rhosts

cat .rhosts
PSD
IBM Certified Specialist - AIX V4.3 Systems Support
IBM Certified Specialist - AIX V4 HACMP
 
Katherine,

Also I forgot to say log in as oracle - and try:

more /etc/hosts

If you cannot open /etc/hosts then chmod to :

644 /etc/hosts

and re-try the more and then the rsh....
PSD
IBM Certified Specialist - AIX V4.3 Systems Support
IBM Certified Specialist - AIX V4 HACMP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top