Changing only file permissions

Kevin Korb kmk at sanitarium.net
Tue Apr 21 18:12:07 MDT 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

First, make note that in the future always run rsync with at least
either --times or --archive.  If you had used --archive you would be
fine and if you had used --times then rsync could just fix the
permissions and ownerships (you would want to dry run first to make
sure that is all it wants to do).

Anyways, the tools you want are getfacl/setfacl from the acl utilities
package...

On the system that is correct do:
cd / ; getfacl -R . > acls.txt
Use your favorite method to transfer that file to the other system
then on it do:
cd / ; setfacl --restore=acls.txt

This will copy the owner, group, permissions, and any ACLs if you use
them from one system to the other.  Any extra files will be untouched.
 I think it will warn about missing files but I would have to test to
verify that.


On 04/21/2015 07:03 PM, James Moe wrote:
> Hello, opensuse 13.2 linux v3.16.7-7-desktop x86_64 rsync v3.1.1
> 
> I used rsync to copy /usr/ to another volume with these options: 
> --recursive --one-file-system --links --stats --itemize-changes 
> --quiet --delete --times After I had modified the system to use the
> new /usr volume, I realized I should have added: --perms --owner
> --group --executability
> 
> So the target volume has everything set as "root root", and useful 
> bits like the SetUID mode are missing.
> 
> Is there a way to use rsync to restore only the 
> permissions/owner/user and mode flags on the target volume from
> the source volume?
> 
> 

- -- 
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
	Kevin Korb			Phone:    (407) 252-6853
	Systems Administrator		Internet:
	FutureQuest, Inc.		Kevin at FutureQuest.net  (work)
	Orlando, Florida		kmk at sanitarium.net (personal)
	Web page:			http://www.sanitarium.net/
	PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlU251cACgkQVKC1jlbQAQd1ywCfdAn4vXWBUIG7yq2MPFskPjNf
jFQAoJO3miUbuY1r9A6AvgIiW8QFzNJX
=CDqe
-----END PGP SIGNATURE-----


More information about the rsync mailing list