------------------------------------------------------------------------------- Remote File Coping Methods for Remotely coping files from one machine to another are many and varied.. The following are some methods I have seen or have succeeded in using for various purposes. Some are not very secure, or may be impossible in most normal situations, unless the machine is re-configured to allow it. Anthony Thyssen ------------------------------------------------------------------------------- Rcp Command For coping between two account owned by the same person, a ".rhosts" file needs to be setup to allow coping (and logins!!!) without a password from one account to another. rcp file dest_mach:file This is is not a good method as it is open to abuse. EG: 1/ a cracker on one account can go to the other without problems 2/ hostname spoofing will allow break-ins 3/ the file transfer could be listened to. --------------------- Scp (Secure Shell (Ssh) Copy Command) This is like the rcp command but is secure, the channel is encrypted from eavesdroppers, and host/account spoofing isn't possible. However if the private key is encrypted (recommended) then a ssh-agent will have to be setup to hold the unencrypted password for the transfer, or your public key access password will have to be entered. scp file dest_mach:file Secure shell ssh will also provide encrypted X windows channel across machines automatically (set DISPLAY and Xauth stuff on remote machine). Environment variables set is also useful to keep track of the initial start machine of ssh links and the exact command being asked to be performed on the remote machine (before the shell meta-characters have been performed). --------------------- Rsync A bit like rdist but faster due to the ability to perform incremental updates (just the changes). That is it can update log files with just the new data, without needing to transfer the whole file. Unlike rdist you can specify the command to use to connect to the remote machine. This program is improving in capabilities and performance all the time. (see ssh-rdist security below) --------------------- Unison A bi-directional Rsync. That is it will transfer the changes between two remote file systems in both directions, synchronising them. It knows when files are deleted, moves or has changes since the last time it ran as it keeps a checksum archive of all the files. You can defines profiles and use a GUI, which will also let you know if there are conflicts. That is the same file was changes differentially on both directories. --------------------- RDist If you can use rcp/scp you can also use rdist to only copy files or whole directories of files which have been modified since the last time it was transferred. I used to use this for keeping multiple unix accounts in sync with my main workstation account. I now use "rsync" for that and "unison" to sync bi-directionally between work and home machines. --------------------- SDist -- The GNU Rdist A separate program to the Ssh stuff which will do rdists over Ssh instead of a rsh like channel. (I have not tried this yet) This has been merged into the Gnu Rdist command, by allowing it to specify the remote connection command). NOTE This is different and incompatible with the rdist on most commercial UNIX operating systems. --------------------- Ftp (Also SFTP - ftp over ssh) This is what FTP was designed for originally. However you need to know the password of the remote account you are transferring to/from. This is fine if you own the account, but if it isn't yours you have a problem. Also as a password is required it can NOT be shell scripted without compromising the password (see next). Also FTP does NOT preserve permissions/ownership/dates (in general) or transfer whole directories recursively. For that it is best to create a TAR archive of the files to transfer, and FTP that. This will also preserve the file information FTP fails to do. --------------------- FTP via anonymous ftp server Put the file on some anonymous ftp server and create ftp script to upload/download the file. You can automatically download files with ftp -n -i << END_FTP open FTP_SERVER_WITH_FILE user anonymous YOUR_EMAIL_ADDRESS get /path/to/some/file local_file bye END_FTP You could also password protect a special ftp access area for this use only. The password would only be used for this purpose. --------------------- Mail To accounts owned by different users or where automatic SSH connections can't be performed (for security reasons), you could send the file via mail. This was very common in the past, but is generally no longer an option as few personal machines can recieve mail, only send mail. People today generally read mail from the cloud. UUencode or Mime will encode binary and text files to allow easy and exact decode at the other end.. EG: on client machine uuencode filename filename | sed 's/^$/`/' |\ mailx -s "MAIL of file filename" user@dest.machine On receiving machine a special mail filter can be setup or "procmail" can be used to send mail with a specific subject though a decode script. cd /path/to/save/dir uudecode < mail or uudecode -p save_filename See the man pages on uuencode uudecode and procmail This system unless protected somehow (EG: PGP or GPG mail encryption ) could be abused by anyone sending mail of the appropriate configuration to your filter. NOTE: I have more info on my trials of this in ../sendmail/hints.mail also code I developed for retrieval of reports, from my research assistant period, using parallel processing on hundreds of machines around the world. --- Anthony --------------------- Interactive Shell Connection Use a interactive "rsh" or "telnet" to do things on the remote machine See the software "expect" to automate this control .../info/co-processing/ NOTE: The program "mconnect" on Sun machines is equivalent to "telnet" but allows you to pipe data in and out normally. --------------------- Roll your own Daemon Create your own network service to transfer information and files between the hosts. This is very DANGEROUS unless you know what you are doing, especially with regard to security. For setting up communications look at "netcat" and "socat" ===============================================================================