I try to write a script to "scp" a file from local server A to remote server B. What I have done is generate the public key from server A, and add it into server B "authorized_keys". Everything is find. I do a small test, and ssh from A to B without password successfully. Here is the command
$ ssh userid@serverB
But here is the question. when I try to execute scp command, get failure because of "Unauthorized access is prohibited".
-bash-4.1$ scp file_name userid@serverB:~
Unauthorized access is prohibited
file_name 100% 0 0.0KB/s 00:00
I have spent a lots of time to find out the reason, but cannot get the right answer. Could anyone let me know, why this happen? Thanks a lot.
~
.scp
copies to the remote user's home directory by default if you don't give a directory.