?
Solved

DOH - screwed up / with bad chmod command - how to recover?

Posted on 2007-03-23
6
Medium Priority
?
1,182 Views
Last Modified: 2013-12-04
DOHHHH!

Logged in as root and from the following directory:

/home/test/transfers

I made the following stupid:

chmod -R 660 /

.... I ctrl-c this as soon as I noticed it was taking a few seconds but now I am wandering what the repercussions I might expect would be. Already I get an error sshing in and am unable to open an sftp session! /sbin/consoletype: Permission denied (fixed that with 777 for now)

Yes I know what 660 permissions are but not sure the effect on / is going to be and what default permissions should be what the best way to recover from this screwup is.  OS is CentOS 4.4


Thanks!

0
Comment
Question by:techwhore
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 

Author Comment

by:techwhore
ID: 18783676
I've been manually going through and trying to correct permissions and trying to compare based on another installation... mostly 755's.

What would help is:

a) Is there a way to reinstall/repair CentOS without losing any of my settings (extra packages installed, /etc/)

b) What command can I use to find all files with 660? I believe find with -perm but I can't get it right.

Thanks
0
 

Author Comment

by:techwhore
ID: 18783732
Also if I build another drive with Centos 4.4 can I just copy all the dirs over? If I do this what do I have to watch out for?
0
 

Author Comment

by:techwhore
ID: 18784450
I guess I am about to find out if I can make things even wors by restoring an ACL dump of the entire filesystem.
0
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

 
LVL 19

Expert Comment

by:Gabriel Orozco
ID: 18786046
I will try to assemble something. I do not warranty it will work or that there is no other better way (MUST BE THERE) but for this quick purpose I'll try to assemble something:


do not disconnect from your system.

now, go to the other system with centos and use it as a base.
you need to see which files are there and their permissions
find . > files    #see what files are there
# add their right permissions:
while read file; do
   echo `stat -c%a $file` $file
done < files > files_perm

#now files_perm has all the files and their permissions. copy that file to your damaged system and now try to set correct permissions based on that other file:
while read file; do
    perm=`echo $file | awk '{print $1}'`
    name=`echo $file | awk '{print $2}'`
    echo chmod $perm $name
    chmod $perm $name
done < files_perm

some files will be missing, some others will show you an error but this should be of help.

you can run this against /etc and /dev directories at least.

good look
0
 

Author Comment

by:techwhore
ID: 18786726
Thanks Redi.

What I was thinking instead is dumping with getacl the clean system and setalc on the one messed up. Anything wrong with that?

Also if you install Centos 4.4 over itself will it pickup the existing install, run ans an upgrade and fix everything leaving settings in place?

0
 
LVL 19

Accepted Solution

by:
Gabriel Orozco earned 1500 total points
ID: 18786883
Great, getacl is a wonderful tool. and copies much more data than what I made.

A reinstall will correct permissions, but I'm not sure what would happen to your current configuration.
I cannot help with the upgrade, neither...

0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
Recently, I read that Microsoft has analysed statistics for their security intelligence report. It revealed: still, the clear majority of windows users do their daily work as administrator. An administrative account is a burden, security-wise. My ar…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month9 days, 12 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question