LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Accidently issued command chmod 777 / (https://www.linuxquestions.org/questions/linux-newbie-8/accidently-issued-command-chmod-777-a-834360/)

san_to_all 09-24-2010 08:00 PM

Accidently issued command chmod 777 /
 
Hi,
I have fedora 10 installed, dual boot with Vista.
I accidently issued command chmod 777 / and now linux is not loading.
I need to backup my important data. I tried accessing files from windows installing some good software but only grub partition is accessible other drive showing nothing.

basheer 09-24-2010 08:26 PM

boot from a live cd.
mount the partition.
chmod 644 /

Hope this helps.

san_to_all 09-24-2010 08:32 PM

I don't have live cd.

HasC 09-24-2010 08:42 PM

Quote:

Originally Posted by san_to_all (Post 4108278)
I don't have live cd.

then get one.

LQ ISO has a lot of links of good live distros.

san_to_all 09-24-2010 08:49 PM

Do I need the exact destro and version of live cd? I mean Fedora10 live cd or any other live cd will do?

dv502 09-24-2010 11:04 PM

@ san_to_all

When you ran chmod 777 /, you only affected the top level directories. If you had done something like this chmod -R 777 /, this would be even more serious.

You could do what the others have mentioned by issuing the command
chmod 644 /, but this would make all directories with those permissions.

The typical root filesystem will have different permission settings like
755, 644, etc and some folders will have additional attributes like the sticky bit -- octal value 1777 (eg. the /tmp folder)

I would do a re-install just to be safe. Make sure you backup your files and bookmarks if you don't have a separate home partition.

- Cheers

linuxlover.chaitanya 09-25-2010 01:33 AM

Quote:

Originally Posted by san_to_all (Post 4108291)
Do I need the exact destro and version of live cd? I mean Fedora10 live cd or any other live cd will do?

Any live distribution should be able to help you out. Not necessarily fedora.
You still using Fedora 10? Why?

Kenny_Strawn 09-25-2010 01:46 AM

Yeah, Fedora 10 is almost two years old. New version please.

unSpawn 09-25-2010 04:47 AM

Quote:

Originally Posted by basheer (Post 4108273)
Hope this helps.

No, it doesn't.


Quote:

Originally Posted by HasC (Post 4108285)
then get one.

Not necessary.


Quote:

Originally Posted by lqlover3074 (Post 4108305)
It might be necessary.

No it isn't.


Quote:

Originally Posted by dv502 (Post 4108346)
I would do a re-install just to be safe.

Not necessary either.


@san_to_all: running 'rpm -qf /' should yield "filesystem" (package name) and then 'rpm --setperms filesystem' should fix things the Red Hat way. Doing it any other way might be distro-agnostic but inconvenient, inefficient, unnecessary, dangerous or whatever else negative. (And yes, you shouldn't run F10 anymore.)





see 'man rpm', the "--setperms" switch.

syg00 09-25-2010 04:58 AM

Cute. Must happen a fair bit then ... :D

unSpawn 09-25-2010 07:00 AM

Quote:

Originally Posted by syg00 (Post 4108500)
Cute.

What is "cute" are matured, supported and maintained package management systems that out of the box still do not provide certain functionality. Of course for certain groups of users dictatorships, philosophies, lore, contracts, herd instinct and whatnot have proven to be way more enticing and important arguments than say manageability and efficiency...

san_to_all 09-26-2010 12:56 AM

I forgot to tell ........
 
Hi,
Sorry guys I forgot to tell you in detail what caused the problem.Here is the story.
I put one simple html page in /var/www/mywebdir/abc.htm just to test weather it is accessible or not. Browser showed error permission denied. then I issued command like this
chmod 777 /var/www/mywebdir/abc.htm
chmod 777 /var/www/mywebdir/
chmod 777 /var/www/
chmod 777 /var/
chmod 777 /

As soon as I issued last command, literally everything was going to its 'roots'! I mean Icons changed like windows 3.1 had, Desktop color changed black and white, and lots of other strange activities was going on. In panic I quickly issued a command chmod xxx / to restore things back(Where xxx was the figure something lower than 777 previliage which I don't remember now. I think it was 421).This does not helped me.I tried to copy my data in pendrive but it was too late.

Anyway I logged in single user mode. and issued a command chmod 644 /
but nothing seems to going right.
I tried unSpawn's suggestion rpm -qf / and rpm --setperms and the response was 'no arguments given for query'
Hopefully lots of linux services started very well.
In error messages, for me, familiar words was selinux, and
/var/log could not open log etc. and other programs showing directory /var

The reason behind using F10 is that I have very old computer with little ram. I fear more advanced destros might not install. But surely I will try to install F13. But most importand thing to me is my data. Which I had not backedup.
------------
Correction:
issuing command rpm -qf / yielded package name filesystem.
but the second command rpm --setperms <filesystem> I typed just rpm --setperms. sorry for that.

dv502 09-26-2010 01:42 AM

@ san_to_all

if you want to have the parent directory and it's sub directories to have the same permissions, all you need to do is add the -R option.

Example

Code:

chmod -R 777 /var/www
BTW, that is a bad permission for a web server. The permission is usually 755 -- and I see some with the permission setting of 705 like the public_html/ folder.

7 (rwx) means the owner (root) can read, write, execute a file or enter the directory.
5 (r-x) means the group user can read, execute a file or enter the directory.
5 (r-X) means everyone can read, execute a file or enter the directory.

The execute bit (--x), the octal value of 1 has two meanings:
  • A file with the execute bit means it is executable.
  • A directory with the execute bit means permission to enter the directory.

Anyway, I will stick to my original suggestion of a re-install if things becomes even more weird. Especially if this is a public internet server. You can't have messed up permissions everywhere as this could compromise your system.

san_to_all 09-26-2010 02:31 AM

What is the exact commond for rpm --setperms
 
I tried unSpawn's suggestion and issued a command
rpm -qf /
and response was filesystem-2.4.19-1.fc10.i386
and issuing commmand
rpm --setperms filesystem-2.4.19-1.fc10.i386
and response was sh: -line 1: syntax error near unexpected token ')'
sh: -line 1: '[ -L '/'] || chmod t a number) '/''

am I entering wrong command?

dv502 09-26-2010 03:09 AM

I wish I could help you with that, but I don't know.

Wait for unSpawn to read the thread, maybe he can pin-point what you are doing wrong or if something is missing from the syntax.


All times are GMT -5. The time now is 08:43 AM.