0

I am having a p[roblem with using rsync; here are the details.

There are two users in this household: call them john and mary. john and mary each have a desktop system running Ubuntu MATE version 18.04.2. There is also a laptop, also running MATE 18.04.2. When MATE was installed on the laptop, john was the original user; he then added mary as the second user.

Both john and mary would like to keep their laptop /home/xxxx data files in sync with their desktop systems. john uses an rsync script on his desktop (not run as sudo) using commands of this form:

directories:

rsync -e ssh -vaz --delete /home/john/funds/ laptop:/home/john/funds/ 1>>/home/john/backup/laptop.out 2>>/home/john/backup/laptop.error

files:

rsync -e ssh -vaz --delete /home/john/swapfix laptop:/home/john/ 1>>/home/john/backup/laptop.out 2>>/home/john/backup/laptop.error

That works just fine: the files are duly sync'ed with no reported errors.

Mary also uses an rsync script from her desktop with commands just like the above:

rsync -e ssh -vaz --delete /home/mary/funds/ laptop:/home/mary/funds/ 1>>/home/mary/backup/laptop.out 2>>/home/mary/backup/laptop.error

&

rsync -e ssh -vaz --delete /home/mary/swapfix laptop:/home/mary/ 1>>/home/mary/backup/laptop.out 2>>/home/mary/backup/laptop.error

That emphatically does not work. The error-report file is long, and shows entry after entry (but not for every item) with "failed: Permission denied (13)" as well as an occasional "Operation not permitted (1)".

That is what might be called "pushing" the files from the source desktop system to the laptop. What does work, however, is "pulling" the files, using a script on the laptop with commands like these:

rsync -e ssh -vaz --delete lynn@lynn:/home/lynn/funds/ /home/lynn/funds/ 1>>/home/lynn/backup/laptop.out 2>>/home/lynn/backup/laptop.error

&

rsync -e ssh -vaz --delete lynn@lynn:/home/lynn/swapfix /home/lynn/ 1>>/home/lynn/backup/laptop.out 2>>/home/lynn/backup/laptop.error

Using "pull" from the laptop seems to meet the need, but I'd much prefer the two systems to work alike, plus I would like to know why what works for john's desktop won't work for mary's.

(I have run ls -a -l in mary's home directories on both the desktop and the laptop and the permissions seem identical.)

I presume that somehow the rsync on the laptop when it is the remote target does not have authority to write in mary's /home/mary directory, but I am darned if I can see why.

Any help, please?

3
  • First, can Mary ssh from her desktop to the common laptop using Mary's useruname? Are the username for Mary the same in her desktop and the common laptop?
    – user68186
    Jul 25, 2019 at 21:41
  • Yes, mary can ssh from her desktop to the laptop (and also access it via the File Browser). And both the user and the group for file ownership are "mary" on both systems. Jul 25, 2019 at 22:24
  • The usernames doesn't matter much, they might be the same, what really matters are the UID's of the users, as for a file or directory not the username is stored in the filesystems but the UID of the file owner. You can check UID of a user with id <username>, check on both machines and compare.
    – mook765
    Jul 26, 2019 at 1:16

1 Answer 1

1

I notice that the push method, you do not specify a username of the remote system (laptop:/home/mary) whereas in the pull method, you do specify a user (lynn@lynn:/home/lynn).

Can you try adding the username to the push command and see how that works?

Are the John and Mary's uid number the same on both the desktop and the laptop? If john's is the and mary's is different, that may be the cause of your problem. I have run into file ownership and permission issues when the uid was different on two systems. I have taken to forcing the username and uid to be the same on all systems when I setup users. May not be required, or the best, but it has seemed to work for me.

3
  • "Can you try adding the username to the push command and see how that works?" Bingo! That did it, and all now works as wanted. Thank you. (My remaining question is why it works for john using the old command structure; perhaps as the first user when the OS was installed, his is the "default" user at that address.) Jul 26, 2019 at 0:19
  • @EricWalker Ubuntu uses numbers instead of usernames internally. The primary user, created at the time of installation is number 1000. The next user created is 1001 and so on. Mary may be 1000 in her desktop and 1001 in the shared laptop. This may cause the ownership and permission problems.
    – user68186
    Jul 26, 2019 at 1:14
  • Ah, yes: I should have remembered that. Thank you for the heads-up. Jul 26, 2019 at 1:30

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.