2

I use rsync backup on my Android device to backup some files from my device to my *nix server. It sort of works, except the target directory and all files under it have their file mode flags set to 075, making them unaccessible to the owner (me).
I guess the flaw is with rsync backup, but I haven't found a way to remedy that.
Is there a way to have a job triggered, when files are transferred via ssh?

My current workaround is to have a cron job setting the file flags to 755 at a regular interval.

I'm using the following rsync command:

rsync -rptgo --progress --delete-after -e "ssh -y -p 22  -i '/sdcard/dss_key'" /sdcard/myfolder user@server:~/
  • Please provide the rsync command you used. – mpy Oct 13 '13 at 11:52
  • @mpy Please see the edit, as I provided the flags. – TheRoadrunner Oct 21 '13 at 15:13
1

Probably the permissions on your mobile device (source) are set to 075. If invoked with the -p parameter rsync preserves the permissions.

When this option is off, permissions are set as follows:

o Existing files (including updated files) retain their existing permissions, though the --executability option might change just the execute permission for the file.

o New files get their "normal" permission bits set to the source file’s permissions masked with the receiving direc‐ tory’s default permissions (either the receiving process’s umask, or the permissions specified via the destination directory’s default ACL), and their special permission bits disabled except in the case where a new directory inherits a setgid bit from its parent directory.

from rsync's manpage

So, you probably have to use

rsync -rtg --progress --delete-after -e "ssh -y -p 22 -i '/sdcard/dss_key'" /sdcard/myfolder user@server:~/

I also omitted the -o (preserve owner) flag, which is only effective, if you log into the destination as root, which you don't do, according to the given command.

  • thanks a lot. Now it works great. I did read the rsync man page, but probably wasn't smart enough to conclude what you pointed out to me here. ;-) – TheRoadrunner Oct 22 '13 at 20:30
  • 1
    @TheRoadrunner: Sometimes the problem with man pages is, that they are too long -- and if you don't know the keyword to search for you are lost ;) – mpy Oct 22 '13 at 20:52

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.