Well, they told me Linux was powerful and offered many ways to shoot myself in the foot. So just now I did. Shoot myself in the foot, I mean. I'd copied some mp3s off my other box while being root -- I hadn't noticed. So to be able to play them in Amarok I did the following while being root: chown -R bert * thinking I was in /home/bert/mp3. I wasn't. I was in /. (no, not the website). It took a while, but now most files (not all of them, so far I can see) are owned by bert. Is there any way to revert this? -- Met vriendelijke groet / Kind regards, Bert Plat / www.bertplat.nl "Saw a sign on a restaurant that said Breakfast, any time -- so I ordered French Toast in the Renaissance. -- Steven Wright
Well, they told me Linux was powerful and offered many ways to shoot myself in the foot. So just now I did. Shoot myself in the foot, I mean.
I'd copied some mp3s off my other box while being root -- I hadn't noticed. So to be able to play them in Amarok I did the following while being root:
chown -R bert *
thinking I was in /home/bert/mp3. I wasn't. I was in /. (no, not the website). It took a while, but now most files (not all of them, so far I can see) are owned by bert. Is there any way to revert this? For the most part, ALMOST everything in /etc, /bin/ , /usr/bin /sbin/usr/sbin and /dev are owned by root. Thyere are a few exceptions. If you have another system, available, you can easily check things out. For instance, on my system, the only 2 things in /etc
On Thursday 27 October 2005 2:51 pm, Bert Plat wrote:
that are not root are vdr and uucp.
If you can afford the time and have a separate /home partition, then a new
install might be best. There are some security scripts that also change
some of the ownerships, but a reinstall will correct your problem and will
hurt less than a hole in your foot.
--
Jerry Feldman
On Thursday 27 October 2005 21:18, Jerry Feldman wrote:
If you can afford the time and have a separate /home partition, then a new install might be best. There are some security scripts that also change some of the ownerships, but a reinstall will correct your problem and will hurt less than a hole in your foot.
Would comparing a SLES9 box to my 10.0 laptop help? I do have /home on a separate partition so a reinstall is an option, although not a favourite one. In the meantime, apart from security reasons, what other effects could this have? -- Met vriendelijke groet / Kind regards, Bert Plat / www.bertplat.nl Hire the morally handicapped.
On Thursday 27 October 2005 3:51 pm, Bert Plat wrote:
Would comparing a SLES9 box to my 10.0 laptop help? I do have /home on a separate partition so a reinstall is an option, although not a favourite one.
In the meantime, apart from security reasons, what other effects could this have? Probably not too much since you effectively downgraded the ownership. But it is possible that some commands either will not work or will not work correctly. I would probably venture to say that since your system seems to be a single-user system the damage is a lot less than it would be if there were multiple users.
But also remember that we are talking about a number of executables,
scripts, configuration files, as well as some data files.
I think that the comparison would work, but remember that SLES does not
install many applications, such as compilers.
--
Jerry Feldman
Bert Plat
Well, they told me Linux was powerful and offered many ways to shoot myself in the foot. So just now I did. Shoot myself in the foot, I mean.
I'd copied some mp3s off my other box while being root -- I hadn't noticed. So to be able to play them in Amarok I did the following while being root:
chown -R bert *
thinking I was in /home/bert/mp3. I wasn't. I was in /. (no, not the website). It took a while, but now most files (not all of them, so far I can see) are owned by bert. Is there any way to revert this?
RPM should have this information: $ rpm -qlv gcc |head lrwxrwxrwx 1 root root 4 Sep 9 18:07 /lib64/32 -> /lib lrwxrwxrwx 1 root root 3 Sep 9 18:07 /usr/bin/cc -> gcc -rwxr-xr-x 1 root root 102920 Sep 9 18:07 /usr/bin/gcc -rwxr-xr-x 1 root root 16125 Sep 9 18:05 /usr/bin/gccbug -rwxr-xr-x 1 root root 28304 Sep 9 18:07 /usr/bin/gcov Ok, this needs to be scripped somehow... Andreas -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
From: Andreas Jaeger
Date: Fri, 28 Oct 2005 08:34:23 +0200 To: Bert Plat Cc: Subject: Re: [SLE] Major oops with chown Bert Plat
writes: Well, they told me Linux was powerful and offered many ways to shoot myself in the foot. So just now I did. Shoot myself in the foot, I mean.
I'd copied some mp3s off my other box while being root -- I hadn't noticed. So to be able to play them in Amarok I did the following while being root:
chown -R bert *
thinking I was in /home/bert/mp3. I wasn't. I was in /. (no, not the website). It took a while, but now most files (not all of them, so far I can see) are owned by bert. Is there any way to revert this?
RPM should have this information:
$ rpm -qlv gcc |head lrwxrwxrwx 1 root root 4 Sep 9 18:07 /lib64/32 -> /lib lrwxrwxrwx 1 root root 3 Sep 9 18:07 /usr/bin/cc -> gcc -rwxr-xr-x 1 root root 102920 Sep 9 18:07 /usr/bin/gcc -rwxr-xr-x 1 root root 16125 Sep 9 18:05 /usr/bin/gccbug -rwxr-xr-x 1 root root 28304 Sep 9 18:07 /usr/bin/gcov
Ok, this needs to be scripped somehow...
Andreas
The below should do it...for some reason, I don't feel particularly
compelled to test this on my system (gulp!)...
It is bash-specific, though.
#!/bin/bash
#
# Fun with temp files
# This one holds a list of all RPMS
# installed on the system
#
RPMLIST_TEMP="/tmp/rpmlist.`date +%s`"
#
# Populate the temp file
# Query for the full list of installed RPMS
# Cut everything from the first "-#" on
#
rpm -qa | sed -e "s/-[0-9].*//g" >> ${RPMLIST_TEMP}
#
# Read the temp file into a variable
# This is an array variable, and each line of the
# file becomes addressable individually.
#
while read rpmline; do
rpmlines[${#rpmlines[@]}]=$rpmline
done < ${RPMLIST_TEMP}
# OUTER LOOP BEGINS HERE
#
# For each element of the array, do some stuff...
#
for (( i = 0 ; i < ${#rpmlines[@]} ; i++ )); do
#
# Just easier
#
PACKAGE="${rpmlines[$i]}"
#
# Another temp file!
#
THISTEMP="/tmp/rpmlist.${PACKAGE}.`date +%s`"
#
# Get the list of files associated with the package, and populate
# the temp
#
rpm -qlv ${PACKAGE} >> ${THISTEMP}
#
# As above, read each line of the file, populate an array variable
#
while read packline; do
packlines[${#packlines[@]}]=$packline
done < ${THISTEMP}
# INNER LOOP BEGINS HERE
#
# Walk through the array variable
# For each element of it, get the path to the file,
# the owner, and the group. Then do the chown.
#
for (( j = 0 ; j < ${#packlines[@]} ; j++ )); do
THISFILE="${packlines[$j]}"
OWNER=`echo ${THISFILE} | awk '{ print $3 }'`
GROUP=`echo ${THISFILE} | awk '{ print $4 }'`
THISFILE_PATH=`echo ${THISFILE} | awk '{ print $8 }'`
chown ${OWNER}:${GROUP} ${THISFILE_PATH}
done
# INNER LOOP IS DONE
#
# Get rid of the package-specific temp file
#
rm -f ${THISTEMP}
done
# OUTER LOOP IS DONE
#
# Get rid of the RPM list
#
rm -f ${RPMLIST_TEMP}
#
# Send a notification. I suspect that this is going to take a
# long, long time to run (hours), so you might not want to sit there
# while it does
#
echo "ownership and group ownership fixed!" | mail -s "Ownership and Group
Correction" -r "your computer
Ian Marlier wrote:
From: Andreas Jaeger
Date: Fri, 28 Oct 2005 08:34:23 +0200 To: Bert Plat Cc: Subject: Re: [SLE] Major oops with chown Bert Plat
writes: Well, they told me Linux was powerful and offered many ways to shoot myself in the foot. So just now I did. Shoot myself in the foot, I mean.
I'd copied some mp3s off my other box while being root -- I hadn't noticed. So to be able to play them in Amarok I did the following while being root:
chown -R bert *
thinking I was in /home/bert/mp3. I wasn't. I was in /. (no, not the website). It took a while, but now most files (not all of them, so far I can see) are owned by bert. Is there any way to revert this?
man chkstat (provided the package is installed chkstat /etc/permissions Sandy -- List replies only please! Please address PMs to: news-reply2 (@) japantest (.) homelinux (.) com
On Fri, 28 Oct 2005, Ian Marlier wrote:
From: Andreas Jaeger
Date: Fri, 28 Oct 2005 08:34:23 +0200 To: Bert Plat Cc: Subject: Re: [SLE] Major oops with chown Bert Plat
writes: Well, they told me Linux was powerful and offered many ways to shoot myself in the foot. So just now I did. Shoot myself in the foot, I mean.
I'd copied some mp3s off my other box while being root -- I hadn't noticed. So to be able to play them in Amarok I did the following while being root:
chown -R bert *
thinking I was in /home/bert/mp3. I wasn't. I was in /. (no, not the website). It took a while, but now most files (not all of them, so far I can see) are owned by bert. Is there any way to revert this?
RPM should have this information:
$ rpm -qlv gcc |head lrwxrwxrwx 1 root root 4 Sep 9 18:07 /lib64/32 -> /lib lrwxrwxrwx 1 root root 3 Sep 9 18:07 /usr/bin/cc -> gcc -rwxr-xr-x 1 root root 102920 Sep 9 18:07 /usr/bin/gcc -rwxr-xr-x 1 root root 16125 Sep 9 18:05 /usr/bin/gccbug -rwxr-xr-x 1 root root 28304 Sep 9 18:07 /usr/bin/gcov
Ok, this needs to be scripped somehow...
Andreas
The below should do it...for some reason, I don't feel particularly compelled to test this on my system (gulp!)...
AAiieee! Egads, don't do it that way. Learn and use RPM!
First, use rpm --setugid <packagename>
then use rpm --setperms
Just do this:
for i in $(rpm -qa); do rpm --setugids $i && rpm --setperms $i; done
--
Carpe diem - Seize the day.
Carp in denim - There's a fish in my pants!
Jon Nelson
From: Jon Nelson
Date: Fri, 28 Oct 2005 08:34:24 -0500 (CDT) Cc: Subject: Re: [SLE] Major oops with chown On Fri, 28 Oct 2005, Ian Marlier wrote:
From: Andreas Jaeger
Date: Fri, 28 Oct 2005 08:34:23 +0200 To: Bert Plat Cc: Subject: Re: [SLE] Major oops with chown Bert Plat
writes: Well, they told me Linux was powerful and offered many ways to shoot myself in the foot. So just now I did. Shoot myself in the foot, I mean.
I'd copied some mp3s off my other box while being root -- I hadn't noticed. So to be able to play them in Amarok I did the following while being root:
chown -R bert *
thinking I was in /home/bert/mp3. I wasn't. I was in /. (no, not the website). It took a while, but now most files (not all of them, so far I can see) are owned by bert. Is there any way to revert this?
RPM should have this information:
$ rpm -qlv gcc |head lrwxrwxrwx 1 root root 4 Sep 9 18:07 /lib64/32 -> /lib lrwxrwxrwx 1 root root 3 Sep 9 18:07 /usr/bin/cc -> gcc -rwxr-xr-x 1 root root 102920 Sep 9 18:07 /usr/bin/gcc -rwxr-xr-x 1 root root 16125 Sep 9 18:05 /usr/bin/gccbug -rwxr-xr-x 1 root root 28304 Sep 9 18:07 /usr/bin/gcov
Ok, this needs to be scripped somehow...
Andreas
The below should do it...for some reason, I don't feel particularly compelled to test this on my system (gulp!)...
AAiieee! Egads, don't do it that way. Learn and use RPM!
First, use rpm --setugid <packagename> then use rpm --setperms
Just do this:
for i in $(rpm -qa); do rpm --setugids $i && rpm --setperms $i; done
Erm...gulp? Well, my script would do the same thing, I think... But it seems the folks who wrote RPM, who are much smarter than me, have already assumed that eventually someone would do what you did. So do it Jon's way. That's better.
participants (6)
-
Andreas Jaeger
-
Bert Plat
-
Ian Marlier
-
Jerry Feldman
-
Jon Nelson
-
Sandy Drobic