Solved

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

Posted on 2007-03-23
6
1,180 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
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
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 500 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Many of us in IT utilize a combination of roaming profiles and folder redirection to ensure user information carries over from one workstation to another; in my environment, it was to enable virtualization without needing a separate desktop for each…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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.

707 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