I am trying to copy a file over from my machine to my personal space on a university server. On my machine, the file is located at /home/karnivaurus/file.pdf.

If I connect to the server with ssh karnivaurus@server.uni.ac.uk, and then run pwd, it prints /homes/karnivaurus. If I run ls, it just displays one directory, foo. What I want to do then, is to copy this file over to the directory /homes/karnivaurus/foo.

So, after exiting the ssh, I enter the local home directory /home/karnivaurus. I then run the command cp paper.pdf karnivaurus@server.uni.ac.uk/foo/paper.pdf, but this returns the error message cp: failed to access ‘karnivaurus@shell1.doc.ic.ac.uk/homes/karnivaurus/paper.pdf’: Not a directory. I have also tried running cp paper.pdf karnivaurus@server.uni.ac.uk/homes/karnivaurus/foo/paper.pdf, but this gives me the same error message.

What am I doing wrong?

closed as off-topic by Stephen Harris, dr01, Anthon, sam, Kusalananda Aug 5 '16 at 15:03

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "This question has been posted on multiple sites. Cross-posting is strongly discouraged; see the help center and community FAQ for more information." – Anthon, sam, Kusalananda
  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Stephen Harris, dr01

Like already mentioned by Stephen Harris, you need to use scp, not cp.

The correct, minimal syntax is: scp user@maschine:/path/to/source/file user@maschine:/path/to/destination/file.

For your example, if you are on your local machine, the following should do:

scp /home/karnivaurus/file.pdf karnivaurus@server.uni.ac.uk:/homes/karnivaurus/foo

Not the answer you're looking for? Browse other questions tagged or ask your own question.