1834207 Members
2618 Online
110066 Solutions
New Discussion

Sorting /etc/passwd file

 
Jasmin Berube
Advisor

Sorting /etc/passwd file

I was wondering if i can sort /etc/passwd file and push maps with /var/yp/ypmake without having any problems? It's because i have about 200 entry in /etc/passwd and it's all mixed up.
3 REPLIES 3
Albert E. Whale, CISSP
Honored Contributor

Re: Sorting /etc/passwd file

Yes, you can sort and push various parts of the /etc/passwd for your use, I just would not replace the file. Try something like the following:

cat /etc/passwd | tail $(wc -l /etc/passwd)-n | sort | tee some_file_name

You'll need to figure out what the value of n is in order to skip the OS Specific Logins.

Hope that helps.
Sr. Systems Consultant @ ABS Computer Technology, Inc. http://www.abs-comptech.com/aewhale.html & http://www.ancegroup.com
Rick Garland
Honored Contributor

Re: Sorting /etc/passwd file

You might also look at modifing the makefile so that UIDs that are lass than 100 are not pushed. These entries are essentially on the local systems (i.e., root) and when you push, you push in the clear. Not a concern if security is not an issue.
Antoanetta Naghiu
Esteemed Contributor

Re: Sorting /etc/passwd file

To avoid problems now and in the future, pay special attention at possible duplicate UID, or mixed up. If you have a local user with the same UID# as a NIS user, the local one take ownership of the files.

If you want to push just part of /etc/passwd file from the server, you can create another password file the will me used by NIS.
Otherwise, I see no problems.