RPM? Reset permissions

Brad Smith brads at redhat.com
Wed May 26 20:31:44 UTC 2004


-R in rpm does not imply recursion. You need to specify the package or
packages that the affected files come from. 

If everything in the affected directory tree is from the same package,
just do rpm --setugids <packagename>. Otherise, something like this
should do the trick:

find <directory> -exec rpm --setugids -f {} \;

Where <directory> is the dir that you chowned. Be warned that if there
are any non-rpm-defined files in this dir then this will create some
really ugly errors but shouldn't (as far as I know) cause any harm. 

Your best bet is to just do it on a per-package basis if there's any
practical way to do that.

--Brad



On Wed, 2004-05-26 at 18:34, Ragone_Andrew wrote:
> Hmm, i seem to get this error when i run the command:
> 
> [/var/lib]
> [root at lifeonedge lib]# rpm -setugids -R .
> sh: line 2: package: command not found
> [root at lifeonedge lib]# 
> 
> Is RPM not configured correctly?
> 
> -----Original Message-----
> From:	Brad Smith [mailto:brads at redhat.com]
> Sent:	Wed 5/26/2004 2:55 PM
> To:	For users of Fedora Core releases
> Cc:	
> Subject:	RE: RPM? Reset permissions
> I mentioned in another reply, but since it's a really useful and barely
> documented feature I'll mention it again. 
> 
> Rpm's --setperms option fixes this easily. For example:
> 
> [root at satsuki root]# ls -l /bin/bash
> -rwxr-xr-x  1 root root 599860 Dec  9 13:09 /bin/bash
> [root at satsuki root]# chmod o-x /bin/bash
> [root at satsuki root]# ls -l /bin/bash
> -rwxr-xr--  1 root root 599860 Dec  9 13:09 /bin/bash
> [root at satsuki root]# rpm --setperms bash
> [root at satsuki root]# ls -l /bin/bash
> -rwxr-xr-x  1 root root 599860 Dec  9 13:09 /bin/bash
> 
> The --setugids option does the same thing with botched ownership.
> 
> Definitely no need to reinstall. =;)
> 
> --Brad
> 
> 
> On Wed, 2004-05-26 at 17:43, Ronald Warsow wrote:
> > hallo
> > 
> > I found this in maximun-rpm from RH9 docu:
> > 
> > rpm -qp --queryformat='[%{FILEMODES:perms} %{FILEUSERNAME}
> > %{FILEGROUPNAME}   %-80{FILENAMES} : %{=NAME}  \n]' *.rpm
> > 
> > running this on the distro cd's for each packages gives the orginal
> > permissions,etc. 
> > running this output against an ls -lR and a lot of "visual grep's" 
> > ;-)) 
> > gives me the view of a lot work to do, quick leading to a faster
> > solution for an mistakenly chmoded and chowned /etc/, /dev, ....
> > FRESH INSTALLATION !
> > good luck !!!
> > 
> > ronald
> > 
> > 
> > 
> > 
> > 
> 





More information about the fedora-list mailing list