[CentOS] chown command goof up
Ross S. W. Walker
rwalker at medallion.com
Mon Feb 12 22:35:25 UTC 2007
> -----Original Message-----
> From: centos-bounces at centos.org
> [mailto:centos-bounces at centos.org] On Behalf Of Ross S. W. Walker
> Sent: Monday, February 12, 2007 5:11 PM
> To: CentOS mailing list
> Subject: RE: [CentOS] chown command goof up
>
> > -----Original Message-----
> > From: centos-bounces at centos.org
> > [mailto:centos-bounces at centos.org] On Behalf Of MrKiwi
> > Sent: Monday, February 12, 2007 4:50 PM
> > To: CentOS mailing list
> > Subject: Re: [CentOS] chown command goof up
> >
> > Ross S. W. Walker wrote:
> > >> -----Original Message-----
> > >> From: centos-bounces at centos.org
> > >> [mailto:centos-bounces at centos.org] On Behalf Of David A.
> Woyciesjes
> > >> Sent: Monday, February 12, 2007 3:35 PM
> > >> To: CentOS
> > >> Subject: [CentOS] chown command goof up
> > >>
> > >> Basically, what I typed was:
> > >> chown -R user2:user2 *
> > >> chown -R user2:user2 .*
> > >> chown -R user2:user2 *.*
> > >> ...all in /home. Duh. I forgot which way recursive went.
> > >> So, I then did:
> > >> chown -R root:root *
> > >> chown -R root:root .*
> > >> chown -R root:root *.*
> > >> ...this time in / to try and f things. Duh again. Other
> > items need to
> > >> have other owners & groups.
> > >>
> > >> So, how can I fix this? In MacOSX, there is a utility
> > >> to fix all
> > >> permissions on the system. Is there a similar item in CentOS?
> > >>
> > >> Here's what I originally wanted to do:
> > >> Started with user1. Got everything setup just right. Then
> > >> created user2.
> > >> I wanted to use all the settings, mail, etc. from user1
> > for user2. My
> > >> thought was to just copy everything in /home/user1 to
> > >> /home/user2, then
> > >> use chown on all of the files. This is where I got myself
> > into this
> > >> pickle...
> > >>
> > >> Any ideas?
> > >
> > > In case nobody just comes out and says it.
> > >
> > > # rpm --setperms `rpm -qa`
> > > # rpm --setugids `rpm -qa`
> > >
> > > Should fix it.
> > >
> > > -Ross
> >
> > Wow! Never knew this one.
> >
> > I have re-read TFM, but there isnt much about the --set*
> > options - could this be used daily as a 'tidy up' sort of
> > routine? or would it screw with *.conf ?
> >
> > rkhunter currently looks for sus executable files, this
> > could reset perms on everything system related?
> >
> > This is what i love about the style of packaging with rpm -
> > you know what happens in an install (and can repeat it!),
> > rather than 'black box' installations with windose where you
> > can never be sure what happened or if a 'refresh' will
> > rewrite local configs.
>
> These options are poorly documented and well needed.
>
> They're basically aliases for compounded rpm commands, basically query
> for specific package tags and execute chown/chmod with them.
>
> Google for "rpm setperms setugids"
>
> Some people have them well documented in their wikis.
>
> I think the aliases are defined somewhere, maybe in
> /usr/lib/rpm or some
> subdir there, you can probably add your own there too.
Yup, just popt aliases, found in /usr/lib/rpm/rpmpopt-4.3.3
rpm alias --setperms -q --qf '[\[ -L %{FILENAMES:shescape} \] ||
chmod %7.7{FILEMODES:octal} %{FILENAMES:shescape}\n]' \
--pipe "grep -v \(none\) | sed 's/chmod .../chmod /'
| sh" \
--POPTdesc=$"set permissions of files in a package"
rpm alias --setugids -q --qf \
'[ch %{FILEUSERNAME:shescape} %{FILEGROUPNAME:shescape}
%{FILENAMES:shescape}\n]' \
--pipe "(echo 'ch() { chown -- \"$1\" \"$3\";chgrp -- \"$2\"
\"$3\"; }';grep -v \(none\))|sh" \
--POPTdesc=$"set user/group ownership of files in a package"
______________________________________________________________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.
More information about the CentOS
mailing list