Los Angeles1
asked on
Linux script to copy files from host to host
I am using RHEL 6.4
Regarding an earlier post where I discovered that I could run a remote script from my host as follows:
I want to write a script that will either:
1> Copy a file from the calling machine to the remote machine
2> Copy a file from one remote machine to another
How can I do this ?
Thanks
Regarding an earlier post where I discovered that I could run a remote script from my host as follows:
putty -t user@host -pw password -m local_commands_file
I want to write a script that will either:
1> Copy a file from the calling machine to the remote machine
2> Copy a file from one remote machine to another
How can I do this ?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The scp solved many a problem.
Thanks
Thanks
The script copies a file passed to it from the command line from a remote server to the local server. You can change the scp command to move the to and from wherever you want.
The file does contain the password in plain text so make sure it only has the necessary read/write permissions. Also you will have to manually ssh into the remote servers from where the script is ran before the script will work. This is so that you can accept the RSA key from the remote server. You could modify the script to send back yes when prompted if you wanted.
Open in new window