Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-03-23
6
Medium Priority
?
1,184 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
Looking for the Wi-Fi vendor that's right for you?

We know how difficult it can be to evaluate Wi-Fi vendors, so we created this helpful Wi-Fi Buyer's Guide to help you find the Wi-Fi vendor that's right for your business! Download the guide and get started on our checklist today!

 
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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

No security measures warrant 100% as a "silver bullet". The truth is we also cannot assume anything but a defensive and vigilance posture. Adopt no trust by default and reveal in assumption. Only assume anonymity or invisibility in the reverse. Safe…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

636 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