Tuesday, June 12, 2012

To remove duplicate entries from list if userids

hi 
i need to remove duplicate entries from the list of userids on a aix server 

how should i proceed 




Hi, 

First question is where are these duplicate user IDs? 

If they are in /etc/passwd then it is a sure sign that the system has 
not been maintained properly. 

AIX keeps user information in files other than /etc/passwd and 
/etc/shadow, which are only there for compatibility reasons. 

You need to use tools like rmuser to remove users, and I would recommend 
that you remove all instances of usernames which are duplicated and then 
re-create the required user IDs using mkuser to ensure that the correct 
information is present in files other than /etc/passwd. Make sure you 
document the attributes of each duplicated user before proceeding with 
the initial deletions. 

If you have entries in ODM which are not present in the /etc/passwd 
file, then you will have to look into using the ODM commands like 
odmdelete, but I will caution you with a big warning that if used 
incorrectly you could render your system unusable. 

If the userIDs are not in /etc/passwd then you can use the 'sort -u' 
command to sort the list, but please ensure that this isn't used on 
/etc/passwd. There are free passwd parsers out there which perform the 
correct manipulations if required. 
Hi, 

You are saying that there ae duplicate IDs, but you have to make sure that 
you know which UID numbers the user is using. 
1. you are saying that there are duplicate user names with different UID 
numbers. 
2. determine which is the correct UID number. 
3. this is solaris ? 
4. remove the wrong entry from the /etc/passwd file 
5. use the pwconv to sync the passwd file and the shadow file
Bah, I got it wrong! I subscribe to both aix and solaris lists - my 
apologies, I got confused ;-) 

Yes, with Solaris you are absolutely right, edit passwd and then use 
pwconv to resync shadow. 

I would still however recommend that the tools useradd, usermod, and 
userdel are used where possible to avoid accidental corruption of the 
passwd and shadow files. 
HI, 
Thanks for the responses 
these user ids are not in /etc/passwd 
these r on seperate file system created for messaging application
You could sort the file using the id field as the key, store output in a new 
file. repeat, using -u (unique) and output to another file, compare the two 
files for differences.

0 comments:

Post a Comment

 
Design by BABU | Dedicated to grandfather | welcome to BABU-UNIX-FORUM