- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Duplicate uid's
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 09:15 AM
01-24-2006 09:15 AM
Anyone know of a command that checks for duplicate uids ? I recently found some dups on one of the recently built servers and I want to check the other 90 to see how widespread the issue is.
Actually I think I'll end up writing the script to check each servers password file against what we refer to as the "master password file" on one server. All other servers are supposed to have had uid's and names assigned from this one master but I'm learning this isn't the case.
Just hoping someone out there has a check-for-duplicate-uid script to save me a few steps.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 09:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 09:34 AM
01-24-2006 09:34 AM
Re: Duplicate uid's
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 09:39 AM
01-24-2006 09:39 AM
Re: Duplicate uid's
This script will print out the duplicate UIDs (if any):
#!/usr/bin/perl
use strict;
my %user;
my ($name, $uid);
while (($name,undef,$uid) = getpwent) {
$user{$uid}++;
}
foreach $uid (keys %user) {
print $uid, "\n" if $user{$uid} > 1;
}
1;
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 10:11 AM
01-24-2006 10:11 AM
Re: Duplicate uid's
Here's a better version. This script finds any duplicate UIDs and reports them along with the associated usernames. Nothing is reported if no duplicates exist.
#!/usr/bin/perl
use strict;
my %user;
my ($name, $uid);
while (($name,undef,$uid) = getpwent) {
push( @{$user{$uid}}, $name );
}
foreach $uid (sort keys %user) {
print "$uid = @{$user{$uid}}\n" if ($#{$user{$uid}}) > 0;
}
...For example:
103 = jay jaykoonz koonz
107 = oper operator
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2006 07:58 AM
01-30-2006 07:58 AM
Re: Duplicate uid's
logins -d will list the user accounts with duplicate IDs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2006 08:06 AM
01-30-2006 08:06 AM
Re: Duplicate uid's
Other options available. do 'man logins'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2006 08:07 AM
01-30-2006 08:07 AM
Re: Duplicate uid's
You wrote, "Why do you have to write perls and C when you already have the logins command ?".
I suppose I could answer, "For fun, of course!". While that is true, I had flat forgotten about the 'logins' command :-))
Thanks!
Regards!
..JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2006 08:38 AM
01-30-2006 08:38 AM
Re: Duplicate uid's
Being an avid scripter myself, I would agree with you it is "fun". Take no offense but I would rather invest my energy in something that is not readily available
Sundar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2006 09:13 AM
01-30-2006 09:13 AM