cp: cannot stat : No such file or directory

If you are logged into the local machine, you would use scp like this:

scp /home/username/some.xml [email protected]:/path/to/directory/

If you are logged into the remote machine (as in the OP), use scp like this:

scp [email protected]:/home/username/some.xml /path/to/directory

Substitute the IP addresses as directed in the commands.


Firstly you will have to use SCP, there is no way to just use cp to copy files over the network.

The scp command should look like the following from your example, note that the directory structure will need to exist on the server receiving the files side;

scp /home/username/some.xml [email protected]:/path/to/directory/

If you haven't already then you will need to logon to the server you're copying the file to and create the directory you wish to copy the file to, i.e;

mkdir /path/to/directory

An alternative would be to use rsync.

Tags:

Ssh

Scp

Centos

Cp