[plug] Recovering from munged permissions

Bernd Felsche bernie at innovative.iinet.net.au
Sat Jul 5 09:57:25 WST 2003


On Sat, Jul 05, 2003 at 12:44:06AM +0800, Cameron Patrick wrote:
> Is there any simple way to recover a whole bunch of file
> permissions to sane defaults?  Someone new to the unix permission
> system managed to set his entire home directory and its contents
> to 7777 (i.e. setuid setgid sticky world-read-write-executable)

tsk tsk.

> and it has fallen upon myself to fix everything.  (Surprisingly,
> everything still seems to work despite the permissions being
> awry.)

You're lucky it wasn't 777.

I once fixed a system that'd been knobbled like that by an errant
administrator by applying the permissions that existed on the
previous backup. i.e. instead of restoring the files, I only used
chmod and chown based on the archive listing.

As a "first bite", have a look at the /etc/ directory and see if you
have files and/or directories named permissions*. Parse the contents
of those first to set appropriate permissions.

> My current plan of attack involves using find and xargs:
> - Set all directories to 755
> - Set all non-directories and non-symlinks to 644
> - Use 'file' to locate ELF executables and chmod them 755
> - Locate shell scripts with egrep -r '^\#\!(.)?/bin/(ba)?sh'

Using "file" would probably be more reliable.

-- 
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ /  ASCII ribbon campaign | I'm a .signature virus!
 X   against HTML mail     | Copy me into your ~/.signature
/ \  and postings          | to help me spread!



More information about the plug mailing list