Sponsored Content
Full Discussion: Remote file copy
Top Forums UNIX for Dummies Questions & Answers Remote file copy Post 4507 by JHeliosfear on Wednesday 25th of July 2001 12:24:01 PM
Old 07-25-2001
rcp'ing ...

There are a couple preparatory measures to take before using the rcp command. The simplest way to rcp between two servers is to do the following:

1.
a. Verify that the sending and receiving servers have the same user added (hence, if you are going to send a file to a directory owned by user1, make sure that it is being sent by user1)

b. If the same user is not on both machines, become root and add them.

2. Go to the home directory of the user on the sending machine and vi a file called ".rhosts (e.g.
cd ~user1
vi .rhosts
)
3. Add an entry to .rhosts
a. If the hostname and i.p. address of the receiving server is NOT within /etc/hosts, add the i.p. address of the receiving server.

b. If the hostname and i.p. address of the receiving server IS within /etc/hosts, simply add the hostname of the receiving server.

4. Repeat the process on the receving server (verify users, & add/ edit the .rhosts file)

5. Test the rcp connection:
touch rcptest
rcp rcptest <receiving server hostname>:<destination>
e.g. rcp rcptest server1:/var/tmp/usr1/files

You should now be able to rcp between the two machines. I hope that this works for you because it has not failed for me. Take care.

Last edited by JHeliosfear; 07-25-2001 at 01:26 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

remote file copy across 2 systems (AIX and SCO)

Hello, Pls i need to copy some data from AIX Unix 4.3 to a SCO Openserve 5.0.5 using rcp command. But i keep on having permission error. WHAT IS THE SOLTION OR WHAT COMMAND CAN I USE AGAIN (4 Replies)
Discussion started by: aji
4 Replies

2. HP-UX

help me to copy remote file

I want to copy dump generated from oracle database to my local DAT drive. Currently I am copying remote file to local drive thru rcp command and later copy it to local DAT. Pls. help me in this. Thanks Man Mohan email address removed (8 Replies)
Discussion started by: manmohan73
8 Replies

3. Shell Programming and Scripting

Copy a file on remote server

I have ssh keys setup and running properly between two servers. I have a Korn shell script that is logging into the remote server and needs to backup the authorized_keys and/or authorized_keys2 files. The following syntax works perfectly ------------------------------------- ssh... (1 Reply)
Discussion started by: sunsysadm2003
1 Replies

4. UNIX for Dummies Questions & Answers

Copy file from Remote Unix box to windows machine

Hi I need to copy a file from the remote unix server to windows machine. I read lot of thrad but didn't worked out. Requesting all to please help. (2 Replies)
Discussion started by: sameerspice
2 Replies

5. Shell Programming and Scripting

copy file from script file to remote computer

hi, i want copy one or group of file from a computer to others, but i have some problem that do not allow me to do this. i do this by scp command like this : scp <file name> root@cpName:destinationAddress but the problem is that it do not it automatically. it means when it is connecting to... (4 Replies)
Discussion started by: MShirzadi
4 Replies

6. Shell Programming and Scripting

tail copy of a file to remote location

Hello, I have a solaris box and a windows server. The windows server runs cygwin for ssh service. I have an audit log in solaris box. When ever new records are added to the log file, this delta has to be trasported to a remote file in windows. I can do a ssh once in a while, but want the... (7 Replies)
Discussion started by: unori
7 Replies

7. Shell Programming and Scripting

copy the latest file in the remote server's directory

Hi Expert Team, I performed the below piece of code to copy the latest file in the remote server's directory to the same server's other directory. But it is not working properly. How can i handle this? Can you please help me..? ssh ${REMOTE_USERID}@${REMOTE_HOSTNAME} "cp -p `ssh... (3 Replies)
Discussion started by: spkandy
3 Replies

8. Shell Programming and Scripting

Copy a file on remote servers

Hey Unix Gurus, I'm having trouble in copying a file on 5 different servers, first how can you do it locally (i.e without the need to ssh to the server you want to copy the file) and if you need to ssh how do u run a command within that server. Please see my code below(it doesn't work somehow).... (10 Replies)
Discussion started by: sexyTrojan
10 Replies

9. UNIX for Advanced & Expert Users

How to copy a file from remote server and preserve timestamp

Hi How to copy a file from remote server and preserve timestamp. Please not, i have to pass username and password to connect to the remote server in the shell script. Can this be achieved with simple ftp ? are there any options in ftp ? Thanks (4 Replies)
Discussion started by: skumar75
4 Replies

10. UNIX for Dummies Questions & Answers

Checking files in remote server and decide to copy file or not

Hi there, I have a problem in my script, I need to check whether file exists in remote server or not, if the file exists, then stop copy else copy the file to the server.. my code is something like this while read $server do if ssh $server "cd $directory_name; if ; then echo "Error:... (2 Replies)
Discussion started by: beezy
2 Replies
rcp(1)							      General Commands Manual							    rcp(1)

NAME
rcp - Copies files between a local and a remote host or between two remote hosts SYNOPSIS
rcp [-pr] source destination The remote copy command (rcp) is used to copy one or more files between the local host and a remote host, between two remote hosts, or between files at the same remote host. OPTIONS
Preserves the modification times and modes of the source files in the copies sent to the destination; extended file attributes (property list), including the access control list (ACL), if any, are not copied. Without this option, the umask command at the destination modifies the mode of the destination file, and the modification time of the destination file is set to the time the file is received. Copies recur- sively, for directories only, each file and subdirectory in the source directory into the destination directory. DESCRIPTION
By default, the mode and owner of an existing destination file are preserved. Normally, if a destination file does not exist, the mode of the destination file is equal to the mode of the source file as modified by the umask command at the destination host. If the -p option is set, the modification time and mode of source files are preserved at the destination host. If the file has extended file attributes (prop- erty list), including the access control list (ACL), they are not copied and rcp returns the rcp: filename: proplist not copied message. If a remote hostname is not specified for either the source or the destination, rcp is equivalent to the cp command. When copying files to or from a remote host, any remote filename or directory name must be prefixed by the name of the remote host and a : (colon). Local filenames and directory names do not need to have a host specified. However, since rcp assumes that a colon terminates a hostname, local filenames or directory names must have a (backslash) inserted before any colons embedded in the name. If you want to specify an IPv6 address for source or destination, you must prefix the address with the [ (backslash, left bracket) charac- ters and terminate the address with the ] (backslash, right bracket) characters. Because the bracket characters are shell metacharacters, you must precede them with the backslash character. The username entered for the remote host determines the file access privileges rcp uses at that host. Additionally, the username given to a destination host determines the ownership and access modes of the resulting destination file or files. If a hostname is not prefixed by user@, the local username is used at the remote host. If a username is entered, that name is used. In either case, the remote host allows access if one of the following conditions is satisfied: The local host is included in the remote host's /etc/hosts.equiv file and the remote user is not the superuser. The local host and username is included in a $HOME/.rhosts file in the home directory of the remote user account. For security reasons, any $HOME/.rhosts file must be owned by either the remote user or the root user and should have permissions set to 600 (read and write by owner only). In addition to the preceding conditions, rcp also allows access to the remote host if the remote user account does not have a password defined. However, for security reasons, use of a password on all user accounts is recommended. If the path for a file or directory on a remote host is not specified or is not fully qualified, the path is interpreted as beginning at the home directory for the remote user account. Additionally, any metacharacters that must be interpreted at a remote host must be quoted using (backslash), " " (double quotes), or ' ' (single quotes). RESTRICTIONS
The rcp command is confused by output generated by commands in a file on the remote host. In particular, the messages, where are you? and stty: Can't assign requested address can result if output is generated by the startup file. EXAMPLES
To copy a file named localfile from the local host to a remote host named host2, enter: rcp localfile host2:/u/eng/fred To copy a remote file named newplan from one remote host, host1, to another remote host, host2, enter: rcp host1:/u/eng/fred/newplan host2:/u/eng/mary To send a directory subtree report from the local host to the home directory of a user named fred at a remote host named host2, and preserve all modes and modification times, enter: rcp -p -r report fred@host2:report The remote file /u/fred/.rhosts includes an entry specifying the local host and username. FILES
Specifies remote hosts from which users can execute commands on the local host (provided these users have an account on the local host). Specifies remote users who can use a local user account. SEE ALSO
Commands: rsh(1), rlogin(1), rshd(8) Files: rhosts(4) rcp(1)
All times are GMT -4. The time now is 05:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy