LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-18-2010, 08:32 AM   #1
beumont
LQ Newbie
 
Registered: Sep 2008
Posts: 20

Rep: Reputation: 0
chmod -R 777 in root directory, please help


I have unfortunately typed "chmod -R 777" in my "/" root directory...

I have some big issues know, please let me know if when I reboot the system the permissions gona change back to what they should be ?
 
Old 09-18-2010, 08:41 AM   #2
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
Quote:
Originally Posted by beumont View Post
when I reboot the system the permissions gona change back to what they should be ?
Of course not.
 
Old 09-18-2010, 09:05 AM   #3
beumont
LQ Newbie
 
Registered: Sep 2008
Posts: 20

Original Poster
Rep: Reputation: 0
So best thing do to is boot from cdrom and change permissions by hand ?
 
Old 09-18-2010, 09:13 AM   #4
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
Maybe. Perhaps someone else can make more suggestions.
 
Old 09-18-2010, 10:05 AM   #5
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Blog Entries: 62

Rep: Reputation: 56
I wonder what the default mode is for the root files (I'd say probably 644). Maybe you can change the permissions back to what they were, perhaps from the Live CD. If not, the only choice may be to reinstall, as many of the root directory files, albeit in other directories, have many different permissions.

Here's what I suggest: Boot from the live CD, and type this:

Code:
sudo chmod -R 644 /media/<your root drive>| grep -v home/*
This will change mode to 644 in all directories except /home.
 
0 members found this post helpful.
Old 09-18-2010, 10:18 AM   #6
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
Quote:
Originally Posted by Kenny_Strawn View Post
Code:
sudo chmod -R 644 /media/<your root drive>| grep -v home/*
This will change mode to 644 in all directories except /home.
NO, IT WON'T!

It will change all directories to 644, and if chmod prints each file it changes (which I doubt), it just won't print the ones for /home, but it will change them to 644.

Also, it will remove executable permission for directories, which means you won't be able to access them!
 
Old 09-18-2010, 10:30 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390
Hi,
Quote:
Originally Posted by beumont
I have unfortunately typed "chmod -R 777" in my "/" root directory...
You now have a big problem if you did this as root user.
Quote:
Originally Posted by beumont
So best thing do to is boot from cdrom and change permissions by hand ?
That would be theoretically possible, but not very practical. Do you know all the permissions of all the thousands of files and directories on your system?? (I have 496391 files and directories at present).

I would suggest backing up all the data (which you probably can restore to their intended permissions by hand), reinstalling your system and restoring the fixed back-up files.

Only way to be sure all is well again.
 
Old 09-18-2010, 10:44 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,882

Rep: Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608
For Slackware you can use MANIFEST.bz2 and the smprms script to reset permissions.
Also for rpm based distros there is a solution here

Regards
 
Old 09-18-2010, 11:30 AM   #9
whk
Member
 
Registered: Jun 2005
Posts: 202

Rep: Reputation: 35
Reinstall.(period)
Chock it up to learning the hard way.
BTW, this might give you a reason to check out other Linux distros.
Also, check out other really bad moves with recursive.
 
Old 09-18-2010, 12:09 PM   #10
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7/10
Posts: 879

Rep: Reputation: 113Reputation: 113
Do you have a backup on your system? If you have critical info on your system you should away do a backup befor installing new software or system modifications so you can roll back with ease.

Reinstalling would be the easier solution but I know you can change all the files back with time and effort. Try to google a script or something that will help you perhaps.
 
Old 09-18-2010, 12:13 PM   #11
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Rep: Reputation: 69
Jeez. At least now you've learned how damaging things can be when you run as root.

I would just reinstall. However if for some reason you can't and you're not running slackware, I would run these two commands to at least get off to a start.

find / -type d -exec chmod 755 {} \;
find / -type f -exec chmod 644 {} \;

The first one finds all the directories and changes them to 755. The 2nd one find all the files and changes them to 644. Generally you want executable permissions on a directory so you or a program can 'cd' into them.

This will take care of the bulk of the filesytem. Then you still need to go in and modify all the stuff you want protected. There's actually a ton of stuff. You will have to go in and set permissions for all the things that should be secure.

Honestly you should just reinstall.

Last edited by trist007; 09-18-2010 at 12:35 PM.
 
Old 09-18-2010, 04:41 PM   #12
beumont
LQ Newbie
 
Registered: Sep 2008
Posts: 20

Original Poster
Rep: Reputation: 0
This is a good move to turn my system in too a virtual machine, the hard way...

I am runnning fedora 13 and when I ssh to the system I always use the root user, what is bad practice

Ssh is now not working anymore so I have to use the vnc viewer destkop, I will reinstll tomorow
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] chmod 777 a directory only for a user not for all ytd Linux - General 16 05-14-2010 01:15 AM
Cannot set chmod for directory to 777 or 666 q.sa Linux - Software 6 07-19-2005 10:36 AM
CHMOD in shell : chmod 777 /usr/ <---is that right? cpanelskindepot Programming 5 07-16-2004 06:37 AM
chmod 777 /* ziggamon Linux - Newbie 2 09-25-2003 12:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:25 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration