For some reason, at my hosted server some mailboxes have ended up with the wrong ownership. (It seems to be where the user has been deleted; their files have been allocated to a different user, which seems odd.) This has caused problems with users finding their quota has been used up even though their mailbox is empty.

Anyway, I have a lot of mailboxes and I want to write a script which will list all the mailboxes not owned by their correct owner. They're all in /var/spool/mail, and should all have a filename that matches the name of the user that owns (or should own) that mailbox. Eg "ls -la" shows:
   -rw-rw---- 1 markroge admin  1234 Fen 28 12:01 markrogers
   -rw-rw---- 1 markroge admin  4321 Fen 28 12:01 someoneelse
(I made up those mailboxes, by the way)

Note that ls truncates the user name to 8 chars - most of my mailboxes are >8 chars.

So, suggestions for a script that would list all files which are not correctly owned, like the second file in the above example?

[If anyone has suggestions as to how this happened I'm also interested in that, of-course, although I'm taking that up with the hosting company.]

--
Mark Rogers
More Solutions Ltd :: 0845 45 89 555


_______________________________________________
Peterboro mailing list
[email protected]
https://mailman.lug.org.uk/mailman/listinfo/peterboro

Reply via email to