wrong command

Dag Wieers dag at wieers.com
Thu Oct 9 15:48:14 UTC 2008


On Fri, 26 Sep 2008, Vivek Mangal wrote:

> By mistake i run below command on root.
> # chown <user> -R /
>
> It changed the ownership of all directories with their respective files
> then how i can recover my system from this problem ?
> i think i have to change back ownership of all directories manually ?
> or their is other way to do this.... ?
> please tell me

A reinstall would be much better, but if you like to live on the edge, 
something like this should work:

rpm -qa --qf '%{name}=%{version}-%{release}\n' | xargs apt-get install --reinstall

This requires you to have all the packages you have installed to be 
available from a repository that is configured in apt.

If you don't have the exact package versions available, you might as well 
do:

rpm -qa --qf '%{name}\n' | xargs apt-get install --reinstall

On a 64bit multilib system this would become a bit more complicated but I 
doubt it is impossible :)

If some packages are not in a repository, you'd have to filter them out 
with some grep -v expression.

BTW A similar thing is possible to convert a RHEL system to CentOS or 
backwards.

-- 
--   dag wieers,  dag at wieers.com,  http://dag.wieers.com/   --
[Any errors in spelling, tact or fact are transmission errors]




More information about the redhat-list mailing list