Rsync using SSH connection with different port and auto changing the permission

The following will copy files from remote server to current directory +/bar so when executed

  • means use the ssh command, use port 9999
  • the permission would be set:
    • files: -rwxrwxr-x
    • directories: drwx--S---
rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 9999" --chmod=Dg+s,ug+w,Fo-w,+X --progress [email protected]:/foo/bar/ .