[英]Rsync does not properly set permissions on Windows folder
我在 Windows 7 上使用 rsync(特別是 cwrsync)。 我正在使用一個簡單的命令:
rsync -r --perms --delete /cygdrive/c/Users/Michael/Documents/Personal/ /cygdrive/c/Users/Michael/Documents/Personal_Backup/
遞歸副本工作正常,除非我要(右鍵單擊/屬性/安全選項卡)在目標上由 rsync 創建的任何文件夾; 我收到以下彈出消息:
{folderName} 的權限排序不正確,可能導致某些條目無效。
我也嘗試了 --acls 選項,但收到以下錯誤:
recv_acl_access:值超出范圍:ff rsync 錯誤:rsync 協議數據 stream(代碼 12)中的錯誤 acls.c(690) [Receiver=3.0。 rsync:連接意外關閉(到目前為止已收到 9 個字節)[sender] rsync 錯誤:rsync 協議數據 stream(代碼 12)中的錯誤 io.c(610)[sender=3.0.8]
無論如何,我只想正確使用 rsync 以便查看 Windows 中的安全權限不會引發錯誤。
在復制發生后,我使用現已棄用的 cacls 將自己重新添加進來。
rsync -avASPC sourceDir/* destDir
cacls destDir /t /e /r doej
cacls destDir /t /e /g doej:f
其中 sourceDir 是源目錄,destDir 是目標目錄,doej 是用戶名。 使用icacls可能會更好,但我還沒有學會它。
我也嘗試過 robocopy,但我似乎沒有完成這項工作所需的權限。
用於 rsync 的標志
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
-r, --recursive recurse into directories
-l, --links copy symlinks as symlinks
-p, --perms preserve permissions
-t, --times preserve modification times
-g, --group preserve group
-o, --owner preserve owner (super-user only)
-D same as --devices --specials
--devices preserve device files (super-user only)
--specials preserve special files
-v, --verbose increase verbosity
-S, --sparse handle sparse files efficiently
-A, --acls preserve ACLs (implies -p, which is also implied by -a)
-P same as --partial --progress
--progress show progress during transfer
--partial keep partially transferred files
-C, --cvs-exclude auto-ignore files in the same way CVS does
從 CACLS 使用的標志
/T Changes ACLs of specified files in
/E Edit ACL instead of replacing it.
/R user Revoke specified user's access rights (only valid with /E).
/P user:perm Replace specified user's access rights.
Perm can be: ...
F Full control
一個詞, Robocopy 。
我在使用 cwRsync 時遇到了完全相同的權限問題,嘗試了很多東西,但似乎都沒有,所以我最終放棄了。
這是默認的 Windows 工具,具有類似(出於您的目的,相同)的功能集。
我昨晚發現了它並完全放棄了 rsync。 它是為類 unix 構建的,因此在 Windows 上可能會遇到一些麻煩。
這讓我開始:
http://www.sevenforums.com/tutorials/187346-robocopy-create-backup-script.html
這是我為自己制作的用於將分區鏡像到外部驅動器的小備份腳本。
不要再回頭看 rsync 了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.