Alexander Farber
2009-Jan-20 16:11 UTC
[CentOS] Generating password string in /var/nis/passwd with Perl
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
Stephen Harris
2009-Jan-20 16:14 UTC
[CentOS] Generating password string in /var/nis/passwd with Perl
On Tue, Jan 20, 2009 at 05:11:27PM +0100, Alexander Farber wrote:> 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> Has anybody already figured out, how to do it from Perl?crypt is the function to call. eg print crypt("hello","ab") abl0JrMf6tlhw The "ab" is the salt and should be chose from [a-zA-Z0-9./] "man 3 crypt" for the C version, which the perl version mimics -- rgds Stephen