LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-22-2003, 03:33 PM   #1
demmylls
Member
 
Registered: Aug 2003
Location: AT
Distribution: Fedora Core 3
Posts: 404

Rep: Reputation: 30
system down by chown


i screwedup my system
i have RH9
and in root user
and set this
# chown -Rv root:root /usr
(just trying using chown)

then i set

# chown -Rv laiseng /usr


after that i

i switch user to laiseng

then

# su
password:

the root password is working

then

copy everything from /root/.kde to /home/laiseng

then i start to notice that my superuser password dont work anymore
everytime i

# su
password:blabalbla (which is my correct password)
su: invalid password

suddenly the password wont work.

i think i have screwedup my ownership of folder and its subfolders

how to set back all files and folders ownership to root again in the current conditions of mine

go to RH9 cd rescue wont let me chown coz file system mounted in readonly and
now the root password wont work.

but when i in RH rescue disk i type in

# login
# user:root
# password:balbalbal

and it work but as soon as i wanted to remount my file system it said cant do that and need a superuser to do that
huh? i am not logged into root account and it still need a root use to do remounting

what else can i try?

how to recover my system since the /usr/X11RC6 is not owned by root and bcoz of this i cant even startx
xserver cant start

hhhhhhhhhhhhhhheeeeeeeeeeeeelllllllllllppppppppppppp.............

please dont tell me to reinstall my linux!
 
Old 11-22-2003, 05:26 PM   #2
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
You can probably fix the chmod. Al you need to do is figure which rpm packages are affected. Once you know the package you can find the original state by doing this:
Code:
# rpm -q --dump setup-2.4-2mdk|awk '{print $1,$6,$7}'
/etc/bashrc root root
/etc/csh.cshrc root root
/etc/csh.login root root
/etc/exports root root
/etc/filesystems root root
/etc/group root root
/etc/host.conf root root
/etc/hosts.allow root root
/etc/hosts.deny root root
...
I cut the listing short but you should get the Idea. If I totally screwed up my /etc directory I could use the output of that command to un-chmod everything. All I have to do is change the awk statement a little awk '{print $6":"$7,$1} and put the whole thing in a chmod.
Code:
# rpm -q --dump setup-2.4-2mdk|awk '{print $6":"$7,$1}'
root:root /etc/bashrc
root:root /etc/csh.cshrc
root:root /etc/csh.login
root:root /etc/exports
root:root /etc/filesystems
root:root /etc/group
root:root /etc/host.conf
root:root /etc/hosts.allow
root:root /etc/hosts.deny

Of course you need to find out which rpm packages are affected, which you can do by using rpm -Va. That will check all packages and report any modifications. But you are only concerned about user/group ownership so you could do something like this:
rpm -Va|grep [UG].
This will probably take a very long time. Once you find the modified files you just need to identify the package the file belongs to then you can re-chmod the files back to where they need to be.

There is probably an easier way but if so I don't know what it would be.

Last edited by /bin/bash; 11-22-2003 at 05:31 PM.
 
Old 11-22-2003, 07:09 PM   #3
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
I'll post this just in case you need it.

Lets say you wanted to return the ownership of all the files from rpm package foobar.i386.rpm.

rpm -q --dump foobar.i386.rpm|gawk '{ command = "chown "$6":"$7" "$1;system (command)}'


<edit> If you want to find all the packages that have files with modified User/Group, do this:
rpm -Va|grep [UG]|rpm -qf `awk '{print $3}'`|sort -u

Note: The above could take a really long time to complete.

Last edited by /bin/bash; 11-22-2003 at 07:28 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
chown loopoo Linux - Newbie 5 08-09-2005 09:38 AM
Chown -R Jakeh2k1 Linux - General 3 10-31-2004 04:23 PM
chown -R ujotne Programming 3 02-25-2004 12:02 PM
chown Sathe Linux - General 13 10-14-2002 11:25 AM
chown? joetec Linux - Newbie 6 04-07-2002 04:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration