My issue is an odd one. I am logged into my University's server with my host name and all that good stuff. I am able to copy files from my local computer into my school's account. My issue, is the other way around. I am unable to transfer files from the school's server onto my local computer. I am fairly certain I have the syntax correct:

rsync -v username@hostname:~/hw0/hello.cpp .

the issue is, is that it copies it the home directory in my schools computer. Anyone know how to fix this?

Or even worse, if I use:

rsync -v username@hostname:~/hw0/hello.cpp /Users/anthony

I get the error message:

rsync: change_dir#3 "Users" failed: No such file or directory(2)

rsync error: errors selecting input/output files, dirs (code 3) at main.c(694) [Receiver=3.1.1]

So overall, I am pretty sure the issue is, is that the command on my school's server is trying to send it within the server, i.e. NOT to my local computer.

  • Are you running those rsync commands on the server or on your Mac? The way they're written, they should be run on the Mac. – cas Oct 10 '15 at 6:24
  • Yes my local computer is a mac, and the server is using Fedora, not sure if that makes a difference. – Anthony Campuzano Oct 10 '15 at 6:25
  • that's not what i asked. the exact computer you run them on (the mac, or the remote server via ssh) is extremely significant. it doesn't matter whether one is a mac or fedora or whatever. what matters is whether the command is run on the remote computer or the local computer. – cas Oct 10 '15 at 6:28
  • Oh sorry! Yes, I am running those commands off of a mac. – Anthony Campuzano Oct 10 '15 at 6:29
  • running them on the mac? or on the remote computer via ssh? – cas Oct 10 '15 at 6:30

If you are running these rsync commands on the remote computer, you are telling it to connect to itself via ssh and copy the file.

If you run them on the Mac, you are telling the mac to connect to the remote computer and copy the file to itself. I presume this is what you want to do.

There are two basic solutions to this:

  1. just run the commands on the Mac itself. The way they are written, they will just work properly in that context.

  2. If you are able to ssh back to your Mac from the Uni computer, you can rewrite the commands so that it is copying local files (local to the remote computer, that is) to the Mac. From the remote computer's perspective, your Mac is a remote computer. For example:

    rsync ~/hw0/hello.cpp anthony@mac-host-or-ip:/Users/anthony/

Note that if your Mac is behind a firewall or NAT gateway or similar, it may be difficult to connect back to your Mac...but solving that is an entirely different problem needing a question of its own.

| improve this answer | |
  • Are you serious! -.- Your first solution worked perfectly! I was issuing the command on the schools computer, that was the first mistake. I was under the impression that I had to be logged into the school's computer for this to work! The book and other sources should of made it clear how the environment where this command is used will affect the results. Thanks so much! I appreciate it! – Anthony Campuzano Oct 11 '15 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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