fastkeys has asked for the wisdom of the Perl Monks concerning the following question:

Hi there

I'm writing a script to update passwords on a Windows 2000 server from a Linux 2.2.19 server with a flat password file.

To debug things, I quickly cobbled up a nasty script as follows:
#!/usr/bin/perl use Expect; $smbpasswd = Expect->spawn("/usr/local/samba/bin/smbpasswd -r +mcmail -U $username") || die "Could not spawn smbpasswd"; print $smbpasswd "xela\n"; print $smbpasswd "alex\n"; print $smbpasswd "alex\n";

When I ran this initially, I got an error that Expect was not able to bind to a pty. I re-compiled the kernel with 10 Unix98 Ptys and now get a new error:

"perl: can't resolve symbol 'ptsname'"

any ideas what is wrong here?

Thanks Alex (fastkeys)

Replies are listed 'Best First'.
Re: Expect can't resolve symbol
by mandog (Curate) on Aug 28, 2001 at 19:49 UTC
    I don't have the knowledge to comment on your problem directly, but you might consider using the password tools and processes that come with Samaba. It looks like once you add the LINUX box to the NT domain, everything happens automagically. Generally it is easier to figure out how to use an existing tool than it is to create a new one.

    Apologies if you have already examined these tools and found them lacking for your purposes.


    --mandog
      What I want to do is use the samba password tool (smbpasswd) in remote mode (-r) to change user passwords in another domain (mail) from a flat file. It works if I manualy type the user's passwords in on the command line but not if I do it via expect. Either I am using expect wrong or there is something I need to alter to make expect work as it should.

      Thanks for your thoughts anyway

      Alex

        Don't ask me why I thought of this. But if you get tired of trying to get Expect to work, you could instead create a chroot environment for smbpasswd where /dev/tty is a pipe or a link to /dev/fd/0 or some other thing that will let you put stuff there for it to read. (:

                - tye (but my friends call me "Tye")