[CentOS] Generating password string in /var/nis/passwd with Perl

Alexander Farber

alexander.farber at gmail.com
Tue Jan 20 16:11:27 UTC 2009


Hello,

in our network we have AD (Win 2003) for user authentication
under Windows and NIS (CentOS 5.2) for same under Linux:

# rpm -qf /var/yp
filesystem-2.4.0-1.el5.centos
ypbind-1.19-8.el5
yp-tools-2.9-0.1
ypserv-2.19-3

I have written a CGI Script to add new users both to AD and
NIS and also to create the home dirs at our NetApp-Filer.
Unfortunately some steps still have to be made by hand
(the sysadmin copy-pastes it from a browser to a shell).

I could skip one manual step (calling yppasswd) if I knew
how to generate the passwd string for /var/nis/passwd:

farber:oav3dV4.Mnj/.:10154153:5725:Alexander
Farber,jn-05/02,,,,:/home/farber:/bin/bash

Has anybody already figured out, how to do it from Perl?
I'm sure there must be some way (smth. with Perl's crypt).

Regards
Alex

PS: Here is my script: http://pastebin.com/m46057a70
       feel free to modify and use



More information about the CentOS mailing list