I log into server_a and run .sh file, which has the following script:
scp user@server_b:/my_folder/my_file.xml user@server_b:/my_new_folder/
to copy files from my_folder to my_new_folder at server_b. It doesn't throw an error, but no files are copied.
Notes:
server_b is accessed by the pre-set rsa_keys.server_a: unix server_b: ubuntuThe end goal is to move or copy/remove files.
There are two possibilities:
Connect from server_a to server_b and do local copy:
ssh user@server_b "cp /my_folder/my_file.xml /my_new_folder/"
Do copy over the server_a. Your method would require the server_b to be able to authenticate to itself, which is probably not the case:
scp -3 user@server_b:/my_folder/my_file.xml user@server_b:/my_new_folder/
Also note that your code copies only one file and not files as you write in the title.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With