[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Hosed /var permissions



> > Reinstalling would be the safe thing to do. It would be very difficult to
> > fix and you'll always might have some permission mismatches opening holes
> > in the system.

I agree that reinstalling would be the safe thing to do.  But
depending upon how comfortable you are at fixing problems I don't
think it would be that difficult to fix.  You have to make a judgement
call.  If you are going to reinstall anyway then you don't have
anything to lose by trying to fix it.

Most things on a unix machine do not require you to reinstall the os.
If your system is running then most of the time you can just correct
the problems and keep moving.  I personally would not reinstall for
just the problem you described.  But you need to do what you feel good
about doing since you will be doing the work and not me.  But I have
seen people recover systems from backup tapes after 'rm -rf /' stopped
after significant damage when they virtually only had 'grep' left on
their system.  By comparison your problem seems easy.

Most files under /var are owned by root:root.  So as a first pass to
fix the problem I would 'chown -R root:root /var' which will correct
the majority of the files, while breaking your mail again.  Save and
restore your mail directory first.  Then I would work only with the
other files and make changes needed to correct those.  That will be
based upon the packages installed on your system and in general will
be custom on each machine.

Someone could give you a listing of /var on their machine and you
could match ownership of all files.  Any files not in the list you
could review since you know those are in a package that you had
installed but that they did not.  Reinstall only those.

In the meantime, my best guess as to commands to fix your system are
these.  Don't do these if you don't feel comfortable and capable of
some system debugging.  I did a recursive listing of my system and
then processed it briefly to turn up the following list.  Notice that
most of these are just so daemons can log to /var/log and write their
pidfile to /var/run.  Looking at the list there are really few that
look too scary outside of that either.

  chown -R root:root /var

  chown -R man:root /var/cache/man
  chown -R gdm:gdm /var/lib/gdm
  chown -R aptproxy:adm /var/log/apt-proxy*
  chown -R mail:adm /var/log/exim
  chown -R news:news /var/log/news
  chown -R proxy:proxy /var/log/squid
  chown -R nobody:nobody /var/log/xfs-xtt
  chown -R mail:mail /var/run/exim
  chown -R www-data:root /var/run/gcache_port
  chown -R identd:nogroup /var/run/identd
  chown -R daemon:daemon /var/spool/cron/atjobs
  chown -R daemon:daemon /var/spool/cron/atspool
  chown -R mail:mail /var/spool/cron/exim
  chown -R lp:lp /var/spool/lpd

  chgrp -R mail /var/mail
  chgrp -R src /var/lib/cvs
  chgrp -R staff /var/local
  chgrp -R games /var/games/bsdgames
  chgrp utmp /var/log/lastlog
  chgrp adm /var/log/samba
  chgrp utmp /var/run/screen
  chgrp proxy /var/run/squid.pid
  chgrp utmp /var/run/utmp
  chgrp mail /var/spool/pop

If any of the above fail then it is because you don't have the package
installed.  For example squid only applies if you have a squid proxy
installed.  So you can safely ignore missing file and directory
errors.

Then you must go back and manually fix local user ownership for
/var/mail/* and /var/spool/cron/crontabs/*.  Those should be owned by
the local users and therefore will be custom on each machine.  Which
you already know since you got that working once already.

If you are using postfix instead of exim then I would reinstall
postfix.  I run postfix here and that is what I would do.  Perhaps
reinstalling exim would be a good idea too.  The permissions for mail
systems are probably the most complex of the subsystems and it is
worthwhile making sure they are right.

HTH and good luck
Bob

Attachment: pgpZqcrBdZesW.pgp
Description: PGP signature


Reply to: