从 Linux 到 Windows 7 的 rsync 创建了我无权访问的文件
我在 cygwin 下使用 rsync 在两台机器上同步我的音乐和图片文件夹。我在Windows机器上对这两个文件夹都有完全的控制权,在Linux机器上的权限一般是-rw--------,归我所有。例如,当我使用 rsync -rvu --delete rsync://fraxtil@linuxmachine:/music/ /cygdrive/d/Music/ 时,它会在 D:\Music 中创建文件和文件夹\,但我无权访问它们,因此 rsync 无法递归到新创建的目录。
我尝试将 --chmod=a+rwx,g+rwx,o+rwx
添加到命令中,将 noacl
添加到 cygwin 的 /cygdrive/ 的 fstab 条目中,并且从 Linux 的 rsyncd.conf 中删除 read only = yes
,但这些都没有解决问题。
我的 rsyncd.conf:
log file = /var/log/rsync.log
timeout = 300
[music]
comment = Music
path = /home/fraxtil/music
#read only = yes
list = yes
uid = fraxtil
gid = fraxtil
auth users = fraxtil
secrets file = /etc/rsyncd.secrets
[pictures]
(mostly the same as above)
cygwin 的 /etc/fstab:
none /cygdrive cygdrive noacl,binary,posix=0,user 0 0
我注意到当我在 cygwin 下从 bash 浏览 D:\ 时,大多数文件的模式为 0200 或 0000。这可能与我的问题有关。然而,奇怪的是,新创建的文件具有模式 0270,这令人困惑,因为这些是我无法访问的文件,但它们具有更多权限。
有什么想法吗?
I'm using rsync under cygwin to synchronize my music and pictures folders across two machines. I have full control over both of these folders on the Windows machine, and the permissions on the Linux machine are generally -rw-------, owned by me. When I use, for example, rsync -rvu --delete rsync://fraxtil@linuxmachine:/music/ /cygdrive/d/Music/
, it creates the files and folders in D:\Music\, but I don't have permission to access them, and as a result rsync fails to recurse into newly created directories.
I've tried adding --chmod=a+rwx,g+rwx,o+rwx
to the command, adding noacl
to cygwin's fstab entry for /cygdrive/, and removing read only = yes
from Linux's rsyncd.conf, but none of these solved the issue.
My rsyncd.conf:
log file = /var/log/rsync.log
timeout = 300
[music]
comment = Music
path = /home/fraxtil/music
#read only = yes
list = yes
uid = fraxtil
gid = fraxtil
auth users = fraxtil
secrets file = /etc/rsyncd.secrets
[pictures]
(mostly the same as above)
cygwin's /etc/fstab:
none /cygdrive cygdrive noacl,binary,posix=0,user 0 0
I've noticed that when I browse D:\ from bash under cygwin, most of the files have mode 0200 or 0000. This might be related to my problem. However, the newly created files, oddly enough, have mode 0270, which is baffling because those are the ones I can't access, yet they have more permissions.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这最初是作为对我原来问题的编辑发布的,但现在存在另一个答案,我需要接受一些东西来保持我的 100% 接受率:
我刚刚从 rsync 命令中删除了 --chmod 位,现在我拥有了适当的权限再次。我已经尝试过 --chmod 与 noacl 和 no --chmod 与 acl,但尚未尝试 no --chmod 与 noacl。后者对我有用。如果有人想解释为什么会这样,我会保持开放。
This was originally posted as an edit to my original question, but now that another answer exists I need to accept something to keep my 100% accept rate:
I just removed the --chmod bit from the rsync command and now I have the proper permissions again. I had tried --chmod with noacl and no --chmod with acl, but hadn't yet tried no --chmod with noacl. The lattermost works for me. I'll leave this open if anyone wants to explain why this happens the way it does.
感谢您的解决方案。
我陷入了磁盘和 USB 磁盘之间的 rsync 困境。
rsync 也在文件夹上创建了奇怪的 NTFS 权限。
添加 --chmod=a+rwx,g+rwx,o+rwx 允许我在本地进行 rsync。
最终命令是:
rsync -rv --delete --exclude "Dropbox/" --chmod=a+rwx,g+rwx,o+rwx /cygdrive/d/source /cygdrive/h/destination
Thanks for the solution.
I was stucked in rsyncing between a disk, and a USB disk.
rsync created stranged NTFS permissions on folder too.
Adding --chmod=a+rwx,g+rwx,o+rwx allow me to rsync locally.
Final command is :
rsync -rv --delete --exclude "Dropbox/" --chmod=a+rwx,g+rwx,o+rwx /cygdrive/d/source /cygdrive/h/destination