Visit Our UNIX and Linux User Community


Check invalid user account


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Check invalid user account
# 1  
Old 12-11-2007
Check invalid user account

Hi

How to check invalid user account?

invalid condition:
1. without home directory
2. home directory is empty
3. no home directory
4. no shell
5. no passwd

user1:x:6000:6000:user1app:/DB/user1:/bin/ksh
# 2  
Old 12-12-2007
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 Smilie
# 3  
Old 12-12-2007
here's something to start with (using Perl):
Code:
#!/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:
Code:
perl check_user_account.pl /etc/passwd

# 4  
Old 12-12-2007
Ironically, none of those conditions are illegal. UNIX often uses accounts that cannot login to perform services.
# 5  
Old 12-12-2007
Quote:
Originally Posted by porter
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
# 6  
Old 12-12-2007
Quote:
Originally Posted by bakunin
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.

Previous Thread | Next Thread
Test Your Knowledge in Computers #227
Difficulty: Easy
According to NetMarketShare, in September 2019 BSD had a 0.01% global market share of the desktop computing market.
True or False?

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Crontab invalid account

Need assistance in crontab issue . Issue is user account getting error "Warning - Invalid account: 'cyborg' not allowed to execute cronjobs" on Solaris 11 Couple of steps I tried 1. Added user to /etc/cron.d/cron.allow 2. Checked if the account is locked *LK* . It is not locked 3. No log... (2 Replies)
Discussion started by: ajayram_arya
2 Replies

2. Red Hat

Failed password for invalid user

Dear All , I have created a user named X and gave sudo permissions for it , So that it can access some commands as root. This particular user can login to the server using SSH login through putty any where with in the network. But there is some issue , when the same user is trying from... (4 Replies)
Discussion started by: jegaraman
4 Replies

3. HP-UX

User account

I need to check actual date a user was disabled on my HP-UX server. Audit is claiming the user account was active during the last audit exercise. (7 Replies)
Discussion started by: cyriac_N
7 Replies

4. AIX

Successful user login, yet system claims invalid info

I have four AIX 6.1.7.4 systems freshly built and ready for our DBAs to do their work. Of the three one runs into an odd issue while logging in as himself, using Putty with ssh protocols. He logs in successfully, but also gets the following error message: : 3004-300 You entered an invalid login... (2 Replies)
Discussion started by: Mike Brendan
2 Replies

5. Solaris

Help me create new user account

I want create user. That user should be login to any server without asking password. How? tell me in detail. :wall: (3 Replies)
Discussion started by: Navkreddy
3 Replies

6. Solaris

id: invalid user name

Hello, We run solaris 8 with nis+, when I do niscat, I can see the user's information, but when I do id from the domain it is saying invalid user. What may be the problem? id: invalid user name: "abyu789" (1 Reply)
Discussion started by: mokkan
1 Replies

7. UNIX for Dummies Questions & Answers

Difference between : Locked User Account & Disabled User Accounts in Linux ?

Thanks AVKlinux (3 Replies)
Discussion started by: avklinux
3 Replies

8. AIX

AIX; Auto clearing of 'too many invalid login attempts by user'

Does anyone have a good script / cron job that handles this? I have looked in smit and see it is clearing this count with: chsec -f /etc/security/lastlog -a "unsuccessful_login_count=0" -s '{userid}' However when I looked around to find ways to automate this I have not found an easy... (0 Replies)
Discussion started by: Keith Johnson
0 Replies

9. Post Here to Contact Site Administrators and Moderators

user account

hi how to disable the useraccount in aix (should not remove). (1 Reply)
Discussion started by: chomca
1 Replies

Featured Tech Videos