Yeah, I was looking into using expect, but turns out there is an easier way...
The manpage for useradmin gives the following usage:
useradmin useradd [ -c comments] login_name
And when telneted or consoled into the filer, you get the same usage for useradmin:
myfiler> useradmin usage: useradmin useradd [-c "comments"] login_name useradmin userdel login_name useradmin userlist [username list]
*However*, if you do the same thing on a non-interactive ssh or rsh, the usage suddenly changes to something much more useable:
ssh myfiler useradmin
usage: useradmin useradd [-c "comments"] login_name passwd useradmin userdel login_name useradmin userlist [username list]
See, now that's much easier to script.
-MikeC (Too lazy to use expect)
-----Original Message----- From: Dirk Schmiedt [mailto:Dirk.Schmiedt@munich.netsurf.de] Sent: Tuesday, November 02, 2004 2:55 PM To: Michael Christian Cc: toasters@mathworks.com Subject: Re: User administration (was ssh scripts)
Michael Christian wrote:
Next question. I want to automate user administration. The whole 'useradmin useradd' thing with its interactive interface and live password addition (who the heck only lets root set a user's pasword?) is probably not going to work with our 500+ filers. 500xNumberOfAdmins. Yeah, right.
The docs point to fairly standard /etc/[passwd,shadow,group] files, but having added a user, I still don't see them on my box. Has anyone automated user management?
Hello Michael
How about using expect? Excerpt from http://expect.nist.gov/ : "Expect is a tool for automating interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, etc. Expect really makes this stuff trivial. Expect is also useful for testing these same applications. And by adding Tk, you can also wrap interactive applications in X11 GUIs."
With the help of "expect" I wrote my own autoinstaller for filers named "NAAI" (NetApp AutoInstaller) who sets up our training machines every week. It's job is to wipe out all(!) tracks of the last week admin class. Connect to the Filers, "set-defaults" the BIOS, boot over TFTP, wipe out
all data on the disks, step through the "setup" dialog, install licenses
and ONTAP, set date and timezone, vol lang and options, and ... much more. ;-)
=> I really can recommend expect for automatisation of filer useradmin/password activities.
Best regards! Dirk
Hello Michael
telnet usage: useradmin useradd [-c "comments"] login_name
ssh usage: useradmin useradd [-c "comments"] login_name passwd
Cool! Thank you for this hint!
See, now that's much easier to script.
That's true in this case!
I will use expect even so ... to automatically find the local/remote-differences at the other commands. :-)
-MikeC (Too lazy to use expect)
Dirk (Too much used to use expect. :-) )