AIX /etc/security/passwd check accounts don't have a password set

Posted on 2012-08-30
Last Modified: 2012-08-30
I want to check that there are accounts with passwords in /etc/security/passwd. Some users such as root do, however, and I need to grep them out.  I'm struggling to this since grep -A and grep -B don't work on AIX and I'm not quite sure how to do this.

        password = blahblahblahx
        lastupdate = 1248784575

        password = *

        password = *

        password = *

        password = *
Question by:lolaferrari
    LVL 68

    Accepted Solution

    AIX's grep has "-p" (="paragraph"):

    grep -p "password = \*" /etc/security/passwd

    Or use awk or egrep to search for "*" (= "invalid password") in the second field of the /etc/passwd entries:

    awk -F: ' $2=="*" ' /etc/passwd

    egrep '^[A-z0-9]*:\*' /etc/passwd

    Author Closing Comment

    fantastic! many thanks!!!

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
    I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now