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? -- --- David Woyciesjes
On Monday 12 February 2007 21:34, David A. Woyciesjes wrote: ...> 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?The rpm-databse contains all you need to know (almost, it wont cover files not owned by any package). "rpm -V PKG" will tell you if that package has files that have been modified since install, including uid:gid). The information can be obtained (dumped) with something like: # rpm --dump -ql PKG which would give you a list of all files in PKG and (among other things) their original uid:gid. I know of no automated way of restoring this so implementing x (rpm --dump -qal | x ) is left as an exercise ;-) /Peter -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20070212/2b16386d/attachment.sig>
> I know of no automated way of restoring this so implementing x > (rpm --dump -qal | x ) is left as an exercise ;-)You mean like rpm's --setperms and --setugids options, which restore files owned by an rpm to their original permissions/owner states? :-P This will not fix permissions issues in /home/<user> however as those files are almost assuredly not owned by an rpm. -- During times of universal deceit, telling the truth becomes a revolutionary act. George Orwell
David A. Woyciesjes spake the following on 2/12/2007 12:34 PM:> 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? >Is this a production machine? You might be damaged beyond a reasonable repair. It can be done, but will be a lot of work. Any possibility of a backup and re-install? I don't know of an easy way to fix this. Root is dangerous! Each directory in /home needs to be chown'd to the owner. IE.. chown -R user1name:user1group /home/user1. The rest of the structure will be tough to repair, as many files and directories are owned by other processes. It will be some work to get everything right. If not a production system, or just starting out, you could delete users, delete home directories, and redo users. If you want users set up a certain way on creation, you put the changes into /etc/skel and they will get copied to the new users directory and chown'd to the newuser when accounts are created. -- MailScanner is like deodorant... You hope everybody uses it, and you notice quickly if they don't!!!!
> -----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 ______________________________________________________________________ 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.
> -----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?To fix the home dirs: # getent passwd | awk -F: '{system("if [ -d "$6" ]; then chown -R "$3":"$4" "$6"; chmod -R 700 "$6";fi")}}' This should set perms for all users (and services!) home directories, make sure the 700 is adequate for service accounts, which is probably is not. -Ross ______________________________________________________________________ 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.