1833710 Members
2508 Online
110063 Solutions
New Discussion

useradd and NIS

 
donC_1
Occasional Advisor

useradd and NIS

Hello,
I'm supporting a proof of concept in which a centralized account admin team will use an off the shelf product to administer NIS accounts in our HP-Unix NIS domain. The products standard behavior parses variables to the useradd/userdel/usermod commands. The problem is that we use /etc/passwd.global and useradd looks for /etc/passwd. The product is flexible enough to be pointed to another command, so in my opinion, getting ahold of perhaps the Linux source code for the user* commands and recompiling to point to /etc/passwd.global, and then naming it something like useradd.nis would be the best approach.
I know some kind of wrapper could be written to accomplish this, but time is critical so I'm open to other suggestions. The main requirement is that the solution behaves just like useradd and can't be interactive due to the nature of the product. Any suggestions would be welcome!
Thanks,
Eric (not Melanee Haywood)
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor

Re: useradd and NIS

There's no easy answer to your problem other than to softlink /etc/passwd.global and /etc/passwd. This is why typically /etc/passwd is used as the source for the NIS passwd map on the NIS master server. If you do get the source, I would add an option to specify the passwd file. Your problems also extend to /etc/group as well so rethinking your source files for NIS might well be the least evil answer.

If I were not going to use /etc/passwd and /etc/group for the maps source files, I would be tempted to build a set of user* commands using Perl. You have the getpwnam(), putpwnam() functions along with the crypt() function to generate password hashes.
If it ain't broke, I can fix that.
donC_1
Occasional Advisor

Re: useradd and NIS

Thanks for the quick response! Fortunately, we are using the standard group file for the NIS group file,so most of the group related commands will still work. Apparently the thinking of the admin that originally set this up was to separate out the local account entries so they wouldn't be published for viewing by anyone with access to the yp commands. Your Perl suggestion is a good one if I had time (or knew Perl). So I'm still leaning towards the source code option, but can't seem to locate it short of a complete distro or RPM. Does anyone have a suggestion of where I could get them?
TIA,
Eric