Hi
How to check invalid user account?
invalid condition:
- without home directory
- home directory is empty
- no home directory
- no shell
- no passwd
user1:x:6000:6000:user1app:/DB/user1:/bin/ksh
Hi
How to check invalid user account?
invalid condition:
user1:x:6000:6000:user1app:/DB/user1:/bin/ksh
Which part are you having trouble with? If you get a bit of a structure built to begin with, you'll find the rest will probably fall into place, then we can help out wherever you hit a snag
here's something to start with (using Perl):
#!/usr/bin/perl
# check_user_account.pl
use strict;
while (<>) {
chomp;
my @line = split /:/, ;
print "home directory is not defined for user $line[0]\n" unless ($line[5]);
print "shell is not defined for user $line[0]\n" unless ($line[6]);
}
run this script as:
perl check_user_account.pl /etc/passwd
Ironically, none of those conditions are illegal. UNIX often uses accounts that cannot login to perform services.
True! And, to expand on this, usually "nobody" doesn't need a password, "root" doesn't have its own home directory, etc., etc.
Maybe my olfactory system is too easily excited, but i thought i could smell the foul odor of homework being done here.
bakunin
i had smelled it too, but am in good mood today, and wrote those lines.