-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The Thursday 2007-05-10 at 23:40 -0800, John Andersen wrote:
> On Thursday 10 May 2007, chika wrote:
> > i've changed permission some files on / partition....
> > mars/: # chmod 755 -R *
Ouch!
> Some files?
> No sir, you chmodded ALL files.
>
> Technically the option should have preceed the octal mode
> but I'm not about to try that out to see what happens.
>
>
> > i think that the best way is reinstall it, isn't it??
>
> Yup. I think that's probably wise, because it will take you
> longer to figure out what the permissions were before you
> did that than to set them back. I don't spoze you have
> a backup you could restore..... no, thought not.
I think I read a method here, years ago, to restore the permissions from
files that came from rpms, but the only thing I can see perusing the man
is checking them.
let me see... it is "--queryformat %{FILEMODES}". Now, the file name...
Ok:
[EMAIL PROTECTED]:~> rpm -q -a --queryformat "%{FILEMODES}\t%{DIRNAMES}
%{BASENAMES}\n"
This outputs a list like:
16877 /usr
16877 /etc/udev
16877 /usr/share/latex2html
33188 /usr/share/susehelp/docserver/index.html.en
33261 /usr/lib/rpm/map-desktop-category.sh
33261 /usr/lib/libcrypto.so.0.9.7
41471 /usr/lib/libadns.so.1
33261 /lib/libgcc_s.so.1
33261 /usr/lib/libdns_sd.so
Now, we have to get those "modes" into something we can use... Let me see:
[EMAIL PROTECTED]:~> rpm -q -a --queryformat
"%{FILEMODES:octal}\t%{DIRNAMES}%{BASENAMES}\n"
40755 /usr
40755 /etc/udev
40755 /usr/share/latex2html
100644 /usr/share/susehelp/docserver/index.html.en
100755 /usr/lib/rpm/map-desktop-category.sh
100755 /usr/lib/libcrypto.so.0.9.7
120777 /usr/lib/libadns.so.1
100755 /lib/libgcc_s.so.1
Now, that sounds more familiar. The needed permissions are the three last
digits. Now, some one with better scripting skills could extract the
needed info... wait.
Not quite, but nice: with ":perms" I get:
drwxr-xr-x /usr
drwxr-xr-x /etc/udev
drwxr-xr-x /usr/share/latex2html
- -rw-r--r-- /usr/share/susehelp/docserver/index.html.en
- -rwxr-xr-x /usr/lib/rpm/map-desktop-category.sh
Ok, so it is:
write the list to a file
extract the three last digits
add chmod to the line
execute the command.
It wouldn't be too dificult, but I'm not in "bored programmer mode" today,
so I leave that as an exercise to the culprit ;-)
Of course, it will have to be executed from a rescue system, but using the
damaged filesystem rpm database.
Doable! ;-)
- --
Cheers,
Carlos E. R.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Made with pgp4pine 1.76
iD8DBQFGRFW4tTMYHG2NR9URAt7SAKCNrA9sLuxhXDgSOlxuohAgB5OZjgCdGtzk
RA1Qt6U7yOk8nixMXByu2qg=
=nMOo
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]