windows 2003 server 使用cwrsync 3 同步文件夹后,权限和安全属性不能同步,直接导致无法使用,查阅资料后发现必须在运行命令前使用SET CYGWIN=nontsec参数

将以下内容保存成.bat批处理文件后即可运行。

@ECHO OFF
SET CYGWIN=nontsec
"c:\Program Files\cwRsync\bin\rsync" -avrr /cygdrive/c/srcdir/ /cygdrive/d/dstdir/

对 于cwrsync 3.0.7以后及cwrsync 4.0以后的版本,由于cygwin已经从1.5升级到1.7,而且cygwin1.7的mount点从注册表改成了/etc/fstab ,cwrsync 4.0.4版本使用CYGWIN=nontsec参数无效,仍然存在目录权限问题,解决方法如下,在rsync.exe的上一级目录新建一个etc目录, 然后在etc目录用写字板新建一个fstab文件,不带扩展名,文件内容为

#edit by gaodi 
#none /cygdrive cygdrive ntfs override,binary,noacl 0 0
none /cygdrive cygdrive binary,posix=0,user,noacl 0 0
C:/Program\040Files/cwrsync / ntfs override,binary,noacl 0 0
C:/Program\040Files/cwrsync/bin /usr/bin ntfs override,binary,noacl 0 0
#C:/Program\040Files/cwrsync/etc/terminfo /usr/share/terminfo ntfs override,binary,noacl 0 0

保存退出。

重新运行rsync.exe 执行同步后目录就不会出现"权限顺序不正确"的提示了。

(主要是第三行起作用,如果只加这一行一定要在最后加一个回车符)

附fstab文件的使用方法:

The Cygwin Mount Table

The /etc/fstab file is used to map Win32 drives and network shares into Cygwin's internal POSIX directory tree. This is a similar concept to the typical UNIX fstab file. The mount points stored in /etc/fstab are globally set for all users. Sometimes there's a requirement to have user specific mount points. The Cygwin DLL supports user specific fstab files. These are stored in the # #directory /etc/fstab.d and the name of the file is the Cygwin username of the user, as it's stored in the /etc/passwd file. The content of the user specifc file is identical to the system-wide fstab file.

The file fstab contains descriptive information about the various file systems. fstab is only read by programs, and not written; it is the duty of the system administrator to properly create and maintain this file. Each filesystem is described on a separate line; fields on each line are separated by tabs or spaces. Lines starting with '#' are comments.

The first field describes the block special device or remote filesystem to be mounted. On Cygwin, this is the native Windows path which the mount point links in. As path separator you MUST use a slash. Usage of a backslash might lead to unexpected results. UNC paths (using slashes, not backslashes) are allowed. If the path contains spaces these can be escaped as '\040'.

The second field describes the mount point for the filesystem. If the name of the mount point contains spaces these can be escaped as '\040'.

The third field describes the type of the filesystem. Cygwin supports any string here, since the file system type is usually not evaluated. The notable exception is the file system type cygdrive. This type is used to set the cygdrive prefix.

The fourth field describes the mount options associated with the filesystem. It is formatted as a comma separated list of options. It contains at least the type of mount (binary or text) plus any additional options appropriate to the filesystem type. Recognized options are binary, text, nouser, user, exec, notexec, cygexec, nosuid, posix=[0|1]. The meaning of the options is as follows.

acl        - Cygwin uses the filesystem's access control lists (ACLs) to
               implement real POSIX permissions (default). This flag only
        affects filesystems supporting ACLs (NTFS) and is ignored
        otherwise.
auto       - Ignored.
binary     - Files default to binary mode (default).
cygexec    - Treat all files below mount point as cygwin executables.
exec       - Treat all files below mount point as executable.
noacl      - Cygwin ignores filesystem ACLs and only fakes a subset of
        permission bits based on the DOS readonly attribute. This
        behaviour is the default on FAT and FAT32. The flag is
        ignored on NFS filesystems.
nosuid     - No suid files are allowed (currently unimplemented).
notexec    - Treat all files below mount point as not executable.
nouser     - Mount is a system-wide mount.
override - Force the override of an immutable mount point (currently "/").
posix=0    - Switch off case sensitivity for paths under this mount point.
posix=1    - Switch on case sensitivity for paths under this mount point
        (default).
text       - Files default to CRLF text mode line endings.
user       - Mount is a user mount.

While normally the execute permission bits are used to evaluate executability, this is not possible on filesystems which don't support permissions at all (like FAT/FAT32), or if ACLs are ignored on filesystems supporting them (see the aforementioned acl mount option). In these cases, the following heuristic is used to evaluate if a file is executable: Files ending in certain extensions (.exe, .com, .bat, .btm, .cmd) are assumed to be executable. Files whose first two characters begin with '#!' are also considered to be executable. The exec option is used to instruct Cygwin that the mounted file is "executable". If the exec option is used with a directory then all files in the directory are executable. This option allows other files to be marked as executable and avoids the overhead of opening each file to check for a '#!'. The cygexec option is very similar to exec, but also prevents Cygwin from setting up commands and environment variables for a normal Windows program, adding another small performance gain. The opposite of these options is the notexec option, which means that no files should be marked as executable under that mount point.

A correct root directory is quite essential to the operation of Cygwin. A default root directory is evaluated at startup so a fstab entry for the root directory is not necessary. If it's wrong, nothing will work as expected. Therefore, the root directory evaluated by Cygwin itself is treated as an immutable mount point and can't be overridden in /etc/fstab... unless you think you really know what you're doing. In this case, use the override flag in the options field in the /etc/fstab file. Since this is a dangerous thing to do, do so at your own risk.

/usr/bin and /usr/lib are by default also automatic mount points generated by the Cygwin DLL similar to the way the root directory is evaluated. /usr/bin points to the directory the Cygwin DLL is installed in, /usr/lib is supposed to point to the /lib directory. This choice is safe and usually shouldn't be changed. An fstab entry for them is not required.

nouser mount points are not overridable by a later call to mount. Mount points given in /etc/fstab are by default nouser mount points, unless you specify the option user. This allows the administrator to set certain paths so that they are not overridable by users. In contrast, all mount points in the user specific fstab file are user mount points.

The fifth and sixth field are ignored. They are so far only specified to keep a Linux-like fstab file layout.

Note that you don't have to specify an fstab entry for the root dir, unless you want to have the root dir pointing to somewhere entirely different (hopefully you know what you're doing), or if you want to mount the root dir with special options (for instance, as text mount).

Example entries:

Just a normal mount point:

c:/foo /bar fat32 binary 0 0
A mount point for a textmode mount with case sensitivity switched off:

C:/foo /bar/baz ntfs text,posix=0 0 0
A mount point for a Windows directory with spaces in it:

C:/Documents\040and\040Settings /docs ext3 binary 0 0
A mount point for a remote directory without ACL support:

//server/share/subdir /srv/subdir smbfs binary,noacl 0 0
This is just a comment:

# This is just a comment
Set the cygdrive prefix to /mnt:

none /mnt cygdrive binary 0 0
Whenever Cygwin generates a Win32 path from a POSIX one, it uses the longest matching prefix in the mount table. Thus, if C: is mounted as /c and also as /, then Cygwin would translate C:/foo/bar to /c/foo/bar. This translation is normally only used when trying to derive the POSIX equivalent current directory. Otherwise, the handling of MS-DOS filenames bypasses the mount table.

If you want to see the current set of mount points valid in your session, you can invoking the Cygwin tool mount without arguments:

Example 3.1. Displaying the current set of mount points

bash$ mount
f:/cygwin/bin on /usr/bin type system (binary,auto)
f:/cygwin/lib on /usr/lib type system (binary,auto)
f:/cygwin on / type system (binary,auto)
e:/src on /usr/src type system (binary)
c: on /cygdrive/c type user (binary,posix=0,user,noumount,auto)
e: on /cygdrive/e type user (binary,posix=0,user,noumount,auto)

You can also use the mount command to add new mount points, and the umount to delete them. However, since they are only noted in memory, these mount points will disappear as soon as your last Cygwin process ends. See the section called 搈ount?and the section called 搖mount?for more information.

Note
When you upgrade an existing older Cygwin installation to Cygwin 1.7, your old system mount points (stored in the HKEY_LOCAL_MACHINE branch of your registry) are read by a script and the /etc/fstab file is generated from these entries. Note that entries for /, /usr/bin, and /usr/lib are never generated.

The old user mount points in your HKEY_CURRENT_USER branch of the registry are not used to generate /etc/fstab. If you want to create a user specific /etc/fstab.d/${USER} file from your old entries, there's a script available which does exactly that for you, bin/copy-user-registry-fstab. Just start the script and it will create your user specific fstab file. Stop all your Cygwin processes and restart them, and you can simply use your old user mount points as before.

本文转自gaodi2002 51CTO博客,原文链接:http://blog.51cto.com/gaodi2002/1618144

windows 2003 server 使用cwrsync同步文件夹的权限问题相关推荐

  1. 访问不同服务器文件共享,windows共享不同用户访问不同文件夹不同权限

    需求:为方便教学管理,3名老师,张老师.李老师.陈老师通过教学机访问服务器对应文件夹下的课件资源,而3名老师各自间无法访问对方的课件资源,另有一台管理员机,可以访问3位老师所有的课件资源. 服务器:w ...

  2. Windows 2003 Server C盘空间被IIS日志文件消耗殆尽案例

    今天突然收到手头一台数据库服务器的磁盘空间告警邮件,C盘空间只剩下5.41GB大小(当系统磁盘剩余空间小于总大小的10%时,发出告警邮件),如下图所示: 由于还有一些微弱印象:前阵子这台服务器的C盘剩 ...

  3. Windows系统下实现两个文件夹自动同步问题(mklink命令的使用)

    Windows系统下实现两个文件夹自动同步问题(mklink命令的使用) 例:E:\My OneNote文件夹同步到OneDrive中 路径1:C:\Users\XXX\OneDrive\My One ...

  4. Windows 2003 Server 设置技巧

    很多人可以用上的泄漏的版本,相对于工作站系统,服务器在由于做了更多的内核优化,所以在稳定性和安全性方面有很大的提高.但是,很多人并不是需要Server的全部功能的,而且Server系统关闭了某些工作站 ...

  5. 怎样取消Windows 2003 server 意外关机提示

    怎样取消Windows 2003 server 意外关机提示 取消系统关机原因方法: (1)打开"开始" --"运行"命令,打开一个运行对话框,在其中输入&qu ...

  6. windows 2003 server右键菜单没有共享选项的解决办法

    windows 2003 server右键菜单没有共享选项的解决办法 首先检查: 1.是否administrator身份登录 2.运行services.msc,检查server,workstation ...

  7. 不同服务器同步文件,不同服务器同步文件夹吗

    不同服务器同步文件夹吗 内容精选 换一换 只有在本端设备为主用节点时支持该操作,当本端设备降至备用节点时,请前往对端设备进行操作.若倒换不成功,可勾选"强制倒换",进行强制操作.只 ...

  8. 异地服务器同步文件夹,异地服务器同步文件夹

    异地服务器同步文件夹 内容精选 换一换 只有在本端设备为主用节点时支持该操作,当本端设备降至备用节点时,请前往对端设备进行操作.若倒换不成功,可勾选"强制倒换",进行强制操作.只有 ...

  9. Windows 2003 server 服务器集群实例

    两台HP DL580:两台SAN Switch:一台MSA1500做 Windows 2003 server 服务器集群实例. <?xml:namespace prefix = o ns = & ...

最新文章

  1. 只读域控制器RODC的安装
  2. xgboost学习率不能大于1的原因
  3. 为什么大家都在吹捧Python?
  4. atitit.it企业管理 项目管理 中的 授权机制 的来源 君权神授 的一定合理性
  5. WebApi Ajax 跨域请求解决方法(CORS实现)
  6. Springmvc 关于静态资源转发的问题解决
  7. 分枝定界法解0/1背包问题
  8. 二叉树遍历(递归与非递归版本)
  9. uniapp打包H5与uniapp打包apk交互,实现扫码功能。
  10. 汇编语言:使用汇编程序计算2的8次方
  11. B/S模式下的MVC架构迭代(2)
  12. 大数据揭秘区块链人才大迁徙:那个你身边悄悄离职的人去哪儿了?
  13. Ubuntu18.04 搜狗输入法安装(史上最好用的输入法安装方法)
  14. iOS软件开发实现类似微信上传图片选择
  15. 无人驾驶环境感知设备中 激光雷达和摄像头各自的优缺点
  16. 【NOWCODE SEVEN】:二分查找/排序
  17. 看linux后台台账,linux怎么查询台账信息
  18. MathType中的公式字体
  19. 你的WordPress网站经常被刷恶意搜索词?这有解决办法
  20. 用matlab验证傅里叶变换的基本性质

热门文章

  1. UA OPTI570 量子力学25 2-level System
  2. 了解C++类的大小和类变量的字节对齐
  3. C++ STL 基本使用Win32 版
  4. VC++ 串行化编程实例
  5. powertool 使用学习总结
  6. 回炉重造-基础规则之类和对象
  7. vs编译项目报错:The OutputPath property is not set for this project
  8. [HEOI2015] 兔子与樱花
  9. js - prototype 继承
  10. shell脚本获取客户端IP