Why does "ps -[u|U] username" not list processes when username is numeric?

Greetings,

The title pretty much says it all. I've snooped everywhere and can't find anything on this. Since our organization went to numeric usernames, using the u|U option for ps returns no processes. Example passwd entry:

320074:DjZAJKXun8HBs:10129:6006:Joe Y:/cadhome/analysis/jy:/bin/bash

The following command returns nothing other than the column names:

ps -fjHU 320074

HOWEVER, the following DOES work.

HOWEVER, ps -fjHU 101129

Honestly I expect both should work and as a caveat we are using NIS(YP). Any insight would be appreciated.

What's your operating system? That's important for how ps behaves.

It can't match ID and name on numbers because that's ambiguous. There could be several "correct" entries, which isn't supposed to be possible.

If you're assigning these numbers arbitrarily, I'd suggest getting them from UNIX instead of giving them to UNIX.

If you have to deal with this as is, you may need to look up the UIDs in situ.

UID=$(awk -F: '$1 == NAME { print $3 ; exit }' NAME="12345" /etc/passwd)

Hello Corona688,
I have both RHEL6.5 and RHEL7.5 and they behave the same. I've not thought about testing it on our couple Ubuntu servers but the need never comes up. The number that we're using as the login ID are employee numbers affectionately known as WorkDay ID's assigned by the AD group. We're using them so the NAS filers play nice with the Linux user when accessing mixed filesystems with permissions controlled by Windows. We were basically forced to since the storage group didn't want to maintain a Linux user name to WorkDay ID map. As for the UID I'm simply incrementing to the next available number. It never dawned on me when this took place that ps would interpret the numeric login ID as the UID. I have to assume that's what's happening. I may end up having to create an alias much like the code you suggested.

The first field in passwd is the username (login name).
It must start with a letter. A number like 320074 is illegal, many Unix tools cannot behave correctly.
u320074 would be a correct username.

Well there you have it. I appreciate the response MadeInGermany. I'm stuck with it now but fortunately there have been no issues other than when I use the ps command. Additionally, since Linux doesn't have the foothold on business as Windows does I'm unable to dictate terms as they do. Maybe someday but I will probably be retired by then. Thank-you all for participating as it is always appreciated.