LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to find out the highest UID number? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-find-out-the-highest-uid-number-4175494541/)

jithinjjc 02-11-2014 09:18 AM

How to find out the highest UID number?
 
i am using linuxcentos system .my question is how to find out the highest UID number of the system using terminal please help me urgently

Habitual 02-11-2014 10:36 AM

Welcome to LQ.

Your question leaves us with 2 possible replies..
The highest UID allowed, or the highest UID assigned?

Please refer to https://en.wikipedia.org/wiki/User_identifier
and reply.

NOTE: We're volunteers here, "urgently" doesn't work.

pingwinowiewc 02-11-2014 11:15 AM

UUID is assigned automatically once you connect with wireles network. Each network has its own way of doing it. Ask network root.

schneidz 02-11-2014 11:29 AM

i think /etc/passwd contains uid:gid (you can probably awk | sort | tail that file).

TB0ne 02-11-2014 01:46 PM

Quote:

Originally Posted by pingwinowiewc (Post 5115669)
UUID is assigned automatically once you connect with wireles network. Each network has its own way of doing it. Ask network root.

The OP is asking about UID...NOT UUID.

szboardstretcher 02-11-2014 02:04 PM

Well,.. thinking off the top of my head here

Code:

cut -f 3 -d: /etc/passwd | sort -n | tail -n 1
Or if the OP is actually looking for the highest UUID,.. i would have to ask 'why?'

sundialsvcs 02-11-2014 10:34 PM

You might not be able to do it at all.

If the passwords are obtained from a conventional /etc/passwd file, then you can potentially scan that file to locate the highest number. But, on a typical corporate system, that file is not maintained, and it is not the source of user-ID information at all. Instead, a central directory-management authority (e.g. LDAP) is used to maintain this information.

divyashree 02-12-2014 12:01 AM

Quote:

Originally Posted by jithinjjc (Post 5115574)
i am using linuxcentos system .my question is how to find out the highest UID number of the system using terminal please help me urgently

Hi jithinjjc, welcome to LQ.

You can find something like this in the file /etc/login.defs, where its defined the max UID that will be assigned to user.
You can change the value also.

PHP Code:

#
# Min/max values for automatic uid selection in useradd.
#
UID_MIN                   500
UID_MAX                 60000 

And to find the current assigned max UID check the /etc/passwd file.


All times are GMT -5. The time now is 10:23 PM.