1748211 Members
4889 Online
108759 Solutions
New Discussion юеВ

/etc/shadow order

 
SOLVED
Go to solution
David Nixon
Valued Contributor

/etc/shadow order

Is the order of records in /etc/shadow significant to any 'C' library lookup function? Or does a shadow record's lack of UID make sorting this file an irrelevance?


2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: /etc/shadow order

As you have discovered, /etc/shadow used login to match the user to his passwd hash; the only possible optimization would be to sort by login but I strongly suspect it makes no difference. The passwd file, itself is searched by two functions: getpwnam() and getpwuid() and because neither function can make assumptions about the order of the file, they must do a linear search yielding an average of n/2 accesses for a find. I strongly suspect /etc/shadow works just like this. 11.x boxes use the passwd/group lookup daemon, pwgrd, to cache and optimize these searches and the library functions use the daemon, if available.


If it ain't broke, I can fix that.
David Nixon
Valued Contributor

Re: /etc/shadow order

No one seems to think that Shadow & Passwd record
order need to correspond - but SUN docs
state they do.