Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!
share|improve this question
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
up vote 1 down vote accepted

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/
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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