I forgot a user that I created on solaris 10, so now I would like to list all user names on my server.

Is it possible (I am root user)? What command I should use if possible?

Somewhere on the net I read getent will list all usernames of a group. I have tried getent without a group as I do not remember group also, but got error message (getent databse usage ..)

  • Show the code that you tried and the error message that you got! – ShiDoiSi Jan 25 '12 at 11:04

getent passwd will list all known users, not only those present on the local /etc/passwd file.

| improve this answer | |

Is there a reason why you cannot use the passwd database?

awk -F':' '{ print $1 }' /etc/passwd

From the perspective of a group, users are usually listed as part of the group in the /etc/group database:


| improve this answer | |
  • 1
    Unless you are on a standalone machine, the password database is not necessarily limited to the accounts stored in the /etc/passwd file. There are other common sources for user accounts, especially NIS and LDAP, the reason why getent is to be preferred. – jlliagre Jan 26 '12 at 14:48
  • @jlliagre - Very true. I took from the OP that getent had already been tried. Additionally my interpretation of the phrase "created on solaris 10" lead me to believe that the user was local, which may be incorrect. – Tok Jan 26 '12 at 21:15

You can use the dispuid command. From the man page:

    dispuid - displays a list of all valid user names

     dispuid displays a list of all user names on the system (one
     line per name).
| improve this answer | |
awk -F':' '{ print $1 ,  $2 }' /etc/shadow | egrep -v "NP|LK"

will print accounts from shadow file that are not locked or have no password - so the rest is active accounts with passwors set - I guess that is what you are after ?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.