What I want to do seems simple: A perl script running under Linux gets a username and password as input. Then it queries a Windows NT domain controller to see if the username and password are valid.

I found the Authen::Smb module, but it doesn't seem to be working, and the fact that it hasn't been updated since 1999 is disturbing.

Here's the code:

#!/usr/bin/perl -w use strict; use Authen::Smb; my $authResult = Authen::Smb::authen('username','passwd', '//PDC', '//BDC', 'NT_DOMAIN'); if ( $authResult == 0 ) { print "User successfully authenticated.\n"; } else { print "User not authenticated with error level $authResult\n"; }

This invariably returns "User not authenticated with error level 1." I've varied the way I specify the BDC and PDC (without slashes, as internet hostnames instead of NT names, and as IP addresses), and that doesn't change anything.

No failed queries show up in the logs of the domain controllers, so it seems like the queries aren't getting there at all.

Anyone know a better way? (My first suggestion to the boss, which was to make the NT guy figure out how to do this against the Linux machine, was met with chilly silence.)


In reply to How do I check WinNT user authentication from *nix? by Ian the Terrible

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.