how to use SCP (secure copy) in UNIX

i have to transfer a file from one server to another. say, my script is running on server 'A' and one file has to be transferred from server 'A' to server 'B' using SCP. i am using it as:

sourceserverA> scp -P <port> userid@serverBhostname:/put/this/here <sourcefile path>

but it is giving "secure connection to server'B' refused". is thr any userID problem or syntax error??

Hi,

you are using the wrong syntax of scp, the first option is the source and the last one is the destination.

So, please try in your script

sourceserverA> scp -P <port> <sourcefile path> userid@serverBhostname:/put/this/here

Regards
Malcom