Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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.

EDIT:
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

 
discard

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.