I am using rsync over ssh and trying without success to sync files to a place inside user home directory.

All the time rsync seams to want to use full paths.

Tried things like:

  • rsync --rsh=ssh /src/ user@server:/dst - obviously creates it in root if it can
  • rsync --rsh=ssh /src/ user@server:~/dst
  • rsync --rsh=ssh /src/ user@server:~dst - creades ~dst in root!
  • What is the result of 2nd command? It should copy the contents of directory /src into the dst directory under user home directory. – Khaled Apr 18 '12 at 12:20
  • @Khaled it doesnt because it gets expanded by the local shell to the home directory of the current user, not the home directory of the remote user. – Patrick Apr 20 '12 at 22:38

Dont try to use an absolute file path on the destination, the default is home.

Leave the path off to place it in home:

rsync /src user@server:

Or use a relative path to place it somewhere relative to home

rsync /src user@server:srccopy

Note you dont need --rsh=ssh either as its the default.

If you wish to copy into the home directory of a user that isnt the one youre logging into the remote machine with, you need to escape the ~ with quotes or a backslash. For example

rsync /src user@server:\~otheruser/

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.