LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I changed the permission of root recursively all 777..... how to recover now?? (https://www.linuxquestions.org/questions/linux-newbie-8/i-changed-the-permission-of-root-recursively-all-777-how-to-recover-now-628692/)

Ankit Sharma 03-17-2008 11:07 AM

I changed the permission of root recursively all 777..... how to recover now??
 
Hello Sir

I am a naive to linux.
I have fedora 7 installed with windows Xp on same machine.

While i was installing one software i got the prompt of Operation not permitted even when i was in root. So i changed the permission of root
recursively to 777.(chmod / -Rf 777 , like that)

So when i restarted the next time many errors came up while starting various services. Then the console of my laptop went very black popping up lots of error dialogue boxes. Then i used the shell mode to change root recursively 742. Now when i restarted it is unable to boot.

Sorry i have just very less idea of Linux .
Can any body help me . How can i recover back. Or atleast how can i
recover my few important files i had made in linux and may be then i reinstall. Due to some important data i dont want to install newly also.

Please someone help me out.
Thanks in advance.

unSpawn 03-17-2008 11:15 AM

Having a mature package management system this ain't no problem. Boot your installation CD in rescue mode, then try 'rpm --root /mnt/rescue -qa |xargs -iX rpm --root /mnt/rescue --setperms 'X''. And FCOL don't fsck with chmod *twice* if you fscked it up the first time. In your case I'd suggest you read first, then think, then decide to read again.

jschiwal 03-17-2008 11:20 AM

I think that one of the packages created the basic filesystem, and if so, it should have a name similar to filesystem. Let's find out the package that created /usr/bin/.

rpm -qf /usr/bin/
jschiwal@hpamd64:~/work/cwork> rpm -qf /usr/bin/
filesystem-10.3-50

Here I'll bork the permissions on one of the system directories:
sudo chmod o+w /usr/bin/

Let's verify the filesystem package:
rpm -qV filesystem
.M...... /usr/bin
.....UG. /usr/share
.....UG. /usr/share/doc

Let's see what the permissions should be:
rpm -qlv filesystem | grep '/usr/bin'
drwxr-xr-x 2 root root 0 Sep 21 14:18 /usr/bin

Now let's fix it based on this info:
sudo chmod 755 /usr/bin/

jschiwal 03-17-2008 11:26 AM

unSpawn: You beat me to the punch and had a better answer. I had to look up what FCOL meant. I don't believe I didn't know that acronym. My Grandpa would yell that all the time. ( not always at me! ).

Ankit Sharma 03-18-2008 05:30 AM

Hello jschiwal sir
 
Hello sir

when i tried to boot with installation cd in rescue disk it asks me
to make an image of existing file system in /mnt/sysimage. But i skipped
it to shell mode. Then as u said i did rpm -qf /usr/bin , but it says
file /usr/bin is not owned by any package . Moreover it is unable to su
also , saying root does not exist.

Also when i booted normally without CD then i got the following thing:

warning: can't aces (null)
exec of init ((null)) failed !! : Bad Address
Kernel panc - not syncing : Attempted to kill init !


Moreover sir as i got windows XP on he same machine which i have been using
by mounting it in /mnt/windows , so can't i just copy my few important files in windows .

Ankit Sharma 03-18-2008 05:37 AM

Sir unSpawn

I tried ur command in rescue mode using CD:

sh-3.2# rpm ......

and then i got to:

>

Now what to do ??
What do u mean by FCOL and fsck ???

Also when i booted normally without CD then i got the following thing:

warning: can't aces (null)
exec of init ((null)) failed !! : Bad Address
Kernel panc - not syncing : Attempted to kill init !

Moreover sir as i got windows XP on he same machine which i have been using by mounting it in /mnt/windows , so can't i just copy my few important files in windows . If so how to do.

Sir i jut new to linux.
Please help me.

unSpawn 03-18-2008 05:58 AM

Quote:

Originally Posted by jschiwal (Post 3091557)
You beat me to the punch and had a better answer.

I don't consider LQ a race of sorts and my answer certainly not as "better". It may be concise but your explanation is much better for new users to understand.


Quote:

Originally Posted by jschiwal (Post 3091557)
I had to look up what FCOL meant. I don't believe I didn't know that acronym. My Grandpa would yell that all the time. ( not always at me! ).

Heh. Well at least you've got vivid memories of him :-]

livetoday 03-18-2008 06:24 AM

Code:

But i skipped it to shell mode
You need to press '[continue]', if you skip then filesystem won't be mounted by rescue operation. After that when you got shell type

Code:

chroot /mnt/sysimage
after that you can continue with the steps explained earlier...

unSpawn 03-18-2008 06:25 AM

Quote:

Originally Posted by Ankit Sharma (Post 3092418)
I tried ur command in rescue mode using CD:

sh-3.2# rpm ......

and then i got to:

>

Now what to do ??

I think it means you copied in the outer quotes, which you should not, since they are only used to denote the command.
Note that you can not execute that until you have mounted your installation. Just to be sure, before you execute anything check if the directory /mnt/sysimage/var/lib/rpm exists. Now use (I've added the dbpath just in case):
Code:

rpm --root /mnt/sysimage --dbpath /mnt/sysimage/var/lib/rpm -qa | xargs -iX rpm --root /mnt/sysimage --dbpath /mnt/sysimage/var/lib/rpm --setperms 'X'
* If for some reason it does not work try:
Code:

cd /mnt/sysimage && rpm --dbpath /mnt/sysimage/var/lib/rpm -qa --dump | awk '{print "chmod", $5, $1}' | sed -e "s|04||g" -e "s|012||g" | /bin/sh

simplicissimus 03-18-2008 07:26 AM

re-install
 
Based on the original question it appears to me that the system has not been in use for long.

I would rather backup the /home directory somewhere and re-install everything (a clean install).

Another option would be to re-install without reformatting - that will overwrite the base system, but leave the home directories and log files in /var intact - in this scenario files are overwritten, but never deleted. Some minor problems could happen with configuration files in the user's home directory, but the /var logfiles will be deleted sooner or later anyway by the system or overwrtitten.

Other mentioned possibilities are probably too difficult for a new user.

As a new user one should rather avoid doing regular things as root, keep important data in one place and do regular backups. And be prepared to re-install a few times before you get used to the system.

Hope this helps,
Regards,
SIMP

Debian User

DotHQ 03-18-2008 09:01 AM

Quote:

Originally Posted by simplicissimus (Post 3092530)
Based on the original question it appears to me that the system has not been in use for long.

I would rather backup the /home directory somewhere and re-install everything (a clean install).

Another option would be to re-install without reformatting - that will overwrite the base system, but leave the home directories and log files in /var intact - in this scenario files are overwritten, but never deleted. Some minor problems could happen with configuration files in the user's home directory, but the /var logfiles will be deleted sooner or later anyway by the system or overwrtitten.

I'll 2nd this option. I would find a way to save the important data on another system and then reinstall. Might be a good excuse to pick you up a 16gig thumb drive to save your data to before you do the reinstall. :D (always a silver lining if you look hard enough. :D)

jschiwal 03-18-2008 08:14 PM

Quote:

Originally Posted by unSpawn (Post 3092445)
I don't consider LQ a race of sorts and my answer certainly not as "better". It may be concise but your explanation is much better for new users to understand.



Heh. Well at least you've got vivid memories of him :-]

You posted your message as I was typing mine.

Using "rpm -V" on individual packages and manually fixing permissions would have been a lot more work, but perhaps it would have a deterrent effect. A lot like writing "I will not use chmod / -Rf" a thousand times on a blackboard!

Which reminds me of a three year old who watched her Daddy install linux on his desktop. The next day at kindergarten, she had reparitioned all of the day care center's computers! She is banned from even touching the computers now.

unSpawn 03-19-2008 06:15 AM

Quote:

Originally Posted by jschiwal (Post 3093305)
Which reminds me of a three year old who watched her Daddy install linux on his desktop. The next day at kindergarten, she had reparitioned all of the day care center's computers! She is banned from even touching the computers now.

I'm sorry to see your offspring being stigmatised. Must be hard for a budding hacker to start her carreer like that. Maybe it builds character :-]

simplicissimus 03-19-2008 06:21 AM

backup somewhere
 
Code:

I'll 2nd this option. I would find a way to save the important data on another system and then reinstall.
I am somewhat puzzled by that comment. What would be a sane reason to do any backup and then leaving the backup file on the same system that will be re-installed and propably also re-formatted?

Backing up 'somewhere' is not very specific, I admit, but 'somewhere' can be anything from a flash drive to an external drive, some storage place on the Internet or a simple floppy if your data fits on it, or your favorite 16gig thumb drive or whatever makes sense to you and is available.

Regards,
SIMP

jschiwal 03-20-2008 11:12 PM

Quote:

Originally Posted by unSpawn (Post 3093643)
I'm sorry to see your offspring being stigmatised. Must be hard for a budding hacker to start her carreer like that. Maybe it builds character :-]

This wasn't my kid. It's from a caller to "The Tech Guy" program.


All times are GMT -5. The time now is 03:54 AM.