Reputation: 41
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.
Upvotes: 3
Views: 7124
Reputation: 26016
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.
Upvotes: 3
Reputation: 302
If you are logged on to the server, why are you authenticating again:
scp user@server_b:/my_folder/my_file.xml user@server_b:/my_new_folder/
You should be in the directory of file or simply use scp and use -v
parameter to see the debug information.
Run as follows:
scp -v /my_folder/my_file.xml user@server_b:/my_new_folder/
It is not a directory nor it is recursive, so you do not need to -r
parameter.
Upvotes: 0