[plug] Recovering from munged permissions
Cameron Patrick
cameron at patrick.wattle.id.au
Sat Jul 5 00:44:06 WST 2003
'ullo all,
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) and it has fallen upon myself to fix
everything. (Surprisingly, everything still seems to work despite the
permissions being awry.)
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'
Now AFAICT that only leaves sorting out dot-files. Nothing bad should
happen if everything inside .kde, .mozilla, .openoffice, and other such
directories are chmod'd to be readable only by their owner? Are there
any dot-files which are normally marked executable that I should know
about?
On an unrelated note: at one point "ls" used to sort ASCIIbetically
with uppercase letters and dotfiles at the top. Recent versions seem to have
stopped doing that and sort case insensitively, ignoring preceding dots.
Is there a simple way to get ls to revert to the original behaviour?
(Preferably some magic that I can stick in my .bashrc that will make
newer ls's see the error of their ways without making older ls's grizzle.)
TIA,
Cameron.
More information about the plug
mailing list