Hello!

On Wed, Jun 08, 2005 at 07:31:29PM +0800, Uwe Dippel wrote:
>[...]

>What I'd want, is to check the passwd file and delete all home dirs that
>have no user account any longer.
>Then, I'd also create home dirs for all users in the passwd without home
>dir yet.
>Since this is a migration of > 100 users from Linux, I don't feel like
>doing it manually and the FAQ stops at importing the accounts.
>Getting the list of the users on Linux doesn't help, there are about 100
>home dirs for archive reasons; without valid accounts.
>So I'd actually need an auto-creation of home dirs for active accounts
>from an OpenBSD passwd file. Plus, I don't need the _ and < 1000.

>I searched Google and in here, but so far without success. Did I overlook
>anything ?

Normal tools should help.

awk to extract the list of directories:

awk -F: '($3 >= 1000 && $1 !~ /^_/) { print $6 }' /etc/passwd

grep the result for the pattern '^/home/' (or whatever your base of
home is), sed that away 's,^/home/,,', sort it. Compare (e.g. using
diff) with the output of ls /home/ | sort.

The lines with + are the directories that shouldn't be there (if you
use the ls output as the second input to diff), the lines with - are
the directories that should be there but aren't. Act upon them properly.

Kind regards,

Hannah.
-- 
  Hannah Schrvter            Entwicklung       [EMAIL PROTECTED]
  Bei Schlund + Partner AG   Brauerstra_e 48   D-76135 Karlsruhe
This specification allows any of these approaches.  Solving the
Halting Problem is considered extra credit. (RFC 3028)

Reply via email to