Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Well, I am having some bad days after 5 years using RHEL. by mistake (or because tired) I did a chmod 755 / (i was trying to change permisison of a htdocs directory but that went right into the server root) not happy with that I did a reboot before the command completed...
This is a RHEL 5 running selinix permissive... The big question is How bad is the mistake? I am waiting for tech at the data center to check. Probably a kernel panic or who knows...
Well on every Linux I've ever seen, / itself has 755 permissions. Did you by chance do a recursive chmod to 755 (so that all files and directories in the system got chmod'ed)? That would be fairly bad since certain programs expect files to have certain permissions. Unfortunately, there's no way to undo a recursive chmod -- you have to go back and change everything back to the correct permissions by hand.
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986
Rep:
I remember something like that happened to me while playing around in my VM, and SELinux told me to run some command that would restore the default permissions (or maybe it was to restore SELinux policies). I ran it repair mode, rebooted, and everything ran fine again.
But you have not yet rebooted, correct? Just leave the system on and wait until tech support gets back to you. In the mean time don't touch anything.
Well, that is the worst mistake I have ever done in a Linux setup. I have asked for an OS RELOAD. Since I upgraded from RHEL 4 days back it is better to be sure the server is ok, than having issues as data and programming work is done.
So the MISTAKE is REALLY bad, a learning be aware (of root dir) when changing permissions!!
For next time remember that next to other things RPM also supports restoring permissions. One way is to use "--setperms", the other way is by extracting information from the RPMDB:
Code:
#!/bin/bash
# Purpose: Restore filesystem permissions from RPM database
# Args: none or package name
# Deps: Bash, GNU utils, rpm
case "$#" in
0) echo "Dump for ALL packages [N|y]?"; read ans; case "${ans:0:1}"
in y|Y) rpmopt="a"; unset pkg;; *) exit 1;; esac;;
*) unset rpmopt; pkg="$1";;
esac
rpm -q${rpmopt} --dump ${pkg}|while read t; do
t=( ${t} ); for i in 3 4; do
case "${#t[$i]}" in 7)
echo "chmod ${t[$i]:3:4} ${t[0]}"
echo "chown ${t[5]}.${t[6]} ${t[0]}";;
esac; done
done
exit 0
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.