有没有办法在两个服务器的目录之间diff chown / chmod?

时间:2021-09-14 16:44:00

Platform: CentOS 5.6 x86_64

平台:CentOS 5.6 x86_64

I have a production server and a development server. I want to debug file ownership and permissions across a large directory structure, which is almost identical, give or take a few ephemeral files in temporary caches.

我有一个生产服务器和一个开发服务器。我想在大型目录结构中调试文件所有权和权限,这几乎完全相同,在临时缓存中提供或获取一些临时文件。

Does anyone know if this is possible? Manually checking file-for-file would not be practical, given the size of the directory tree.

有谁知道这是否可能?考虑到目录树的大小,手动检查file-for-file是不切实际的。

Thanks in advance.

提前致谢。

2 个解决方案

#1


2  

http://linuxconfig.org/backup-permissions-in-linux

http://linuxconfig.org/backup-permissions-in-linux

This is the BEST script to bakup and restore the permissions of directories. When you get the directory permissions list from both servers, just run a diff on them (you might want to make some modificatins before that)

这是bakup和恢复目录权限的最佳脚本。当您从两个服务器获取目录权限列表时,只需对它们运行差异(您可能希望在此之前进行一些修改)

#2


2  

Just use find on both directory servers with the -ls flag, like:

只需在带有-ls标志的两个目录服务器上使用find,例如:

find directory_a -not ( test_for_ephemeral_files ) -ls > listing_a
find directory_b -not ( test_for_ephemeral_files ) -ls > listing_b
diff listing_a listing_b

#1


2  

http://linuxconfig.org/backup-permissions-in-linux

http://linuxconfig.org/backup-permissions-in-linux

This is the BEST script to bakup and restore the permissions of directories. When you get the directory permissions list from both servers, just run a diff on them (you might want to make some modificatins before that)

这是bakup和恢复目录权限的最佳脚本。当您从两个服务器获取目录权限列表时,只需对它们运行差异(您可能希望在此之前进行一些修改)

#2


2  

Just use find on both directory servers with the -ls flag, like:

只需在带有-ls标志的两个目录服务器上使用find,例如:

find directory_a -not ( test_for_ephemeral_files ) -ls > listing_a
find directory_b -not ( test_for_ephemeral_files ) -ls > listing_b
diff listing_a listing_b