0

I am getting an error when I try to copy a file from my local computer to a remote server. I get the same error whether I use cp or scp.

Here is my input at the resulting error:

[root@xxx.xx.xxx.xx /]# cp /home/username/some.xml root@xxx.xx.xxx.xx:/path/to/directory/  
cp: cannot stat ‘/home/username/some.xml’: No such file or directory

I have checked, and there is definitely a file at the path /home/username/some.xml on my local machine.

Both the local computer and the remote server are running CentOS 7. How can I resolve this error and copy successfully?

CodeMed
  • 354
  • 3
  • 9
  • 27

1 Answers1

2

You have TWO problems.

A: you're apparently are on the machine you're trying to copy to, rather than the one you're trying to copy from

B: cp cannot transfer between machines.

To resolve A try

scp username@YYY.YYY.YYY.YYY:/home/username/some.xml /path/to/directory/
tink
  • 1,586
  • 2
  • 11
  • 15
  • My `cp` command in my OP above was correct with two minor modifications. 1.) I had to type `exit` to log out as `root@remote.server` and thus get a prompt on my local machine, and 2.) I had to change `cp` to `scp` in order to send the data to the remote web server. Since your answer pointed me in the right direction, I am accepting, it, but the solution was what I am typing in this comment. +1 for helping. – CodeMed Dec 09 '14 at 21:17