1833428 Members
3662 Online
110052 Solutions
New Discussion

Remote copy a file

 
Vasudevan MV
Frequent Advisor

Remote copy a file

Hi,

Can any one tell me how to copy a file from one machine to another remote machine with out using rcp command? or else what are all ways to do the same?.

Thanks
Vasu
13 REPLIES 13
Steven Sim Kok Leong
Honored Contributor

Re: Remote copy a file

Hi,

Other methods:
1) scp (secured equivalent of rcp - you need to install ssh)
2) sftp (secured equivalent of ftp - you need to install ssh)
3) ftp
4) nfs

Hope this helps. Regards.

Steven Sim Kok Leong
Michael Tully
Honored Contributor

Re: Remote copy a file

Hi,

Try using using 'ftp'

If your systems are secure most of the time I create a 'tar' archive of a directory for example or large file and then 'ftp' the file across to the other server.

HTH
Mick
Anyone for a Mutiny ?
Nick Wickens
Respected Contributor

Re: Remote copy a file

ftp ?

Or how about

tar cf - /tmp/file | remsh host2 "(cd /;tar xf -)"

Or setup an NFS mount of a filesystem between the two machines and copy files via that directory ? .
Hats ? We don't need no stinkin' hats !!
Ceesjan van Hattum
Esteemed Contributor

Re: Remote copy a file

Implement automounter /autofs.

Share your homedirectory on the systems. On each system you will have your files available.
Put the copyfile in your homedir, log on to the other host and your file is there as well... no need to use rcp, ftp.

Regards,
Ceesjan
Vasudevan MV
Frequent Advisor

Re: Remote copy a file

Hi,

Thanks for quick response.
Scenairo:

There are n number of machines, once I update a file under the user's home directory on box-1 it should update the same file on all the boxes. But they will not provide password & they will not allow rcp or ftp or remsh?.

Can we send that file as a mail & detach it at the other end automatically, if this is possible how can we do that?. or else is there any other way to do that?.

Thanks
Vasu
RAC_1
Honored Contributor

Re: Remote copy a file

If it is small text file

remsh hostname cat file1 > file2

file2 gets created on local machine

There is no substitute to HARDWORK
Stefan Farrelly
Honored Contributor

Re: Remote copy a file


Surely they must allow you to use scp or sftp (secure versions - so all traffic is encryped and thus safe ?)

HP now provide a free supported version of ssh (Secure shell) you can download from www.software.hp.com

T1471AA A.03.10.001 HP-UX Secure Shell

The only other way to do it is use the automounter (man automount) but this means using nfs to mount your filesystem on box-1 to all the other servers - this is not secure so surely using ssh is much much better.

If any of your files to copy/propogate are greater than 2GB then the only program you can use is gtar (gnu tar). All other programs wont copy files that big (automount, rcp, cpio etc.)

Im from Palmerston North, New Zealand, but somehow ended up in London...
Justo Exposito
Esteemed Contributor

Re: Remote copy a file

Hi Vasu,

You can do it by an email by defining an alias in the aliases file into the /etc/mail directory.

You can define an alias called file for instance with something like this:

file:"|cat - > /directory/file"

When you define a new alias you must run newaliases command in order to update the mail database.

With this approach you can put the mail in the file and directory where you want to have.

More information at man aliases.

Hope this helps,

Justo.
Help is a Beatiful word
BFA6
Respected Contributor

Re: Remote copy a file

If this file is to be updated on a regular basis, you could possibly use rdist.

Regards,

Hilary
Frank Slootweg
Honored Contributor

Re: Remote copy a file

> Scenario:
>
> There are n number of machines, once I update a file under the user's home directory
> on box-1 it should update the same file on all the boxes. But they will not provide
> password & they will not allow rcp or ftp or remsh?.

*Why* do they not allow passwords or the use of these tools?

> Can we send that file as a mail & detach it at the other end automatically, if this is
> possible how can we do that?.

These are conflicting requirements! I.e. *automatic* unpacking (your "detach") is even more dangerous than rcp et al, because *anyone* can send mail, probably even from outside the target company. With rcp et al, the receiver at least gets to define which host(s) or/and user(s) can install things on hir system.

> or else is there any other way to do that?.

On the other hand, if you just want to mail the files and let the receiver *manually* install them, then you can just send them a shar (shell-archive, see shar(1)) with the files.
Sanjay_6
Honored Contributor

Re: Remote copy a file

Hi Vasu,

You may see if "rdist" is of any help. Try "man rdist" for more help on this command.

Hope this helps.

Regds
Arockia Jegan
Trusted Contributor

Re: Remote copy a file

Here are the ways,

1. ftp
2. secure ftp ... eg: sftp, psftp
3. scp
4. nfs
4. samba

Most of the people mentioned about first four ways. If you have configured samba server on your HP system and share the directories with windows you can copy the file/directories the way you copy the files between windows systems. If you share the directories with unix systems it's just like nfs.
Patrick Wallek
Honored Contributor

Re: Remote copy a file

Your only recourse, if you can't actually log into the boxes, may be rdist, as Sanjay suggested.

http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B2355-90147/B2355-90147_top.html&con=/hpux/onlinedocs/B2355-90147/00/00/85-con.html&toc=/hpux/onlinedocs/B2355-90147/00/00/85-toc.html&searchterms=rdist&queryid=20020621-112956

The above link is a document on setting up rdist on 11.0. Note that rdist requires remsh access, so it sounds as if this is not an option for you either.

Without some sort of login id and password to the other machines, there is really not a whole lot you can do to get the update(s) out to the other machines.