LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   How to sort regular users and system users from /etc/passwd (https://www.linuxquestions.org/questions/red-hat-31/how-to-sort-regular-users-and-system-users-from-etc-passwd-204021/)

joeyBig 07-12-2004 02:37 AM

How to get the list of all users
 
hi,
how to get the complete list of normal users.
ofcourse, /etc/passwd and /etc/shadow displays the complete list of users, both normal and system users. But i need to separate the normal users and system users.
where can i find this detail.
precisely, i need to know how redhat-config-users displays the system users and normal users separately.
I need the same for groups too :-)
regards,
joe

slakmagik 07-12-2004 02:54 AM

No idea about the RH app but a real basic thing (not at all guaranteed by rule, but the usual case) is that UIDs and GIDs for regular users added to the system start at a higher number (1000/100, 500/50, whatever) while system stuff is under that. Just a rule of thumb. Not sure if there's a solid precise way.

joeyBig 07-12-2004 05:06 AM

thank you digiot,

what you said is absolutely correct.
regular users ofcourse have their user ids getting started from 500.
but, there is a system user " nfsnobody " with userid 65534 in my system.
i wish to know whether only nfsnoby has such high user id,
or is there any other such system users with high user id.
and if possible how to sort out the regular users.
thank you once again digiot :-)

regards,
joeyBig

joeyBig 07-12-2004 05:59 AM

How to sort regular users and system users from /etc/passwd
 
hi,
how could i sort regular users from the complete list of users present in /etc/passwd.
usually regular users has user ids starting from 500.
there is a system user "nfsnobody" with user id 65534 in my system,
for which, the /etc/passwd entries are as below.

nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin

if suppose i should blindly sort users according to the user id, like...user id's above 500...,
the above said system user also gets included in that.
and moreover, there might be other system users having such high user ids.

please let me know if any other method is used to retrieve the complete list of regular users.
and i wonder how the redhat-config-user application displays the system users and regular users separately. If you could help me with the technique followed in redhat-config-users,
that would be more helpful to me.

precisely,
i need to list out all the regular users, with their user id, group id, password change date, etc...
my foremost need is to list all the regular users separately.

thanks 'n regards,
joeyBig.

XavierP 07-12-2004 06:02 AM

JoeyBig - you will notice that I have merged your threads. This is because they are pretty much the same question, the later one giving more detail. Please do not double post.

sandgroper 07-12-2004 07:05 AM

If you want to sort the regular users from the system users by using their IDs , or any other search string , then you can use either grep or awk with regular expressions.

You will need to supply the range of the IDs or a search string common to one group or the other to do the search for either the regular or system users.

grep is easy to use , but awk is a far more powerful utility to use.
Read up on both grep and awk first to see exactly what they can do.

nagasreekrishna 05-27-2008 02:11 AM

hi
 
hi
i want to get the list of regular or normal users from /etc/shadow please help me asap
thanks in advance

billymayday 05-27-2008 02:14 AM

Can you define normal users as those with a directory in /home?

nagasreekrishna 05-27-2008 02:27 AM

ya ths right what i meant by normal users are those who r in /home

chrism01 05-29-2008 12:59 AM

This'll give you users with a /home dir: username, userid, grpid

grep /home /etc/passwd |cut -d: -f1,3,4


All times are GMT -5. The time now is 01:09 AM.