Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 ..)

share|improve this question

migrated from stackoverflow.com Jan 26 '12 at 13:13

This question came from our site for professional and enthusiast programmers.

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

3 Answers 3

up vote 3 down vote accepted

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

share|improve this answer
add comment

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:

plugdev:x:46:someusername

share|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
add comment

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

NAME  
    dispuid - displays a list of all valid user names

DESCRIPTION  
     dispuid displays a list of all user names on the system (one
     line per name).
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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