1753534 Members
5983 Online
108795 Solutions
New Discussion юеВ

unique UID and username.

 
SOLVED
Go to solution
Sanjiv Sharma_1
Honored Contributor

unique UID and username.

Is there any command/script using which I can check that each user is assigned a unique UID and username?

OS = HP-UX 11.11

Thanks in advance.
Everything is possible
3 REPLIES 3
Sandman!
Honored Contributor
Solution

Re: unique UID and username.

# logins -d

...will show all duplicate UIDs in the /etc/passwd file.
James R. Ferguson
Acclaimed Contributor

Re: unique UID and username.

Hi Sanjiv:

To add to the discussion, NEVER declare additional accounts with a uid=0 (to create a duplicate 'root' account).

For example, if you defined the user 'sadmin' with a uid=0, and then later did:

# find / -user sadmin -exec rm -rf {} \+

...then you would remove ALL files and directories belonging to 'root' (uid=0). By the time you realized your mistake it would be time to reinstall your system! Numbers matter to Unix; not names.

Regards!

...JRF...
A. Clay Stephenson
Acclaimed Contributor

Re: unique UID and username.

You must be working on SOX requirements:

The attached script, dupacct.sh, will list duplicate UID's and duplicate login's. If stdin is a terminal, output goes to stdout otherwise the duplicates and a message is sent to syslog. You should have no trouble adapting to your needs. I cron this guy to run once per week and then OV/O detects any of the syslog entries and alerts me. No news is good news.




If it ain't broke, I can fix that.