home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / admin / 6991 < prev    next >
Encoding:
Internet Message Format  |  1993-01-08  |  1.5 KB

  1. Path: sparky!uunet!olivea!charnel!rat!usc!wupost!darwin.sura.net!gatech!usenet.ins.cwru.edu!agate!dog.ee.lbl.gov!news!avalon.nwc.navy.mil!saturn!dejesus
  2. From: dejesus@saturn.nwc.navy.mil (Francisco X DeJesus)
  3. Newsgroups: comp.unix.admin
  4. Subject: Re: passwd
  5. Message-ID: <C0Jyo7.2xL@avalon.nwc.navy.mil>
  6. Date: 8 Jan 93 20:38:30 GMT
  7. References: <1ikbatINNgl8@matt.ksu.ksu.edu>
  8. Sender: usenet@avalon.nwc.navy.mil (NWC News Admin)
  9. Organization: Science Applications International Corp.
  10. Lines: 26
  11.  
  12. In article <1ikbatINNgl8@matt.ksu.ksu.edu> holland@matt.ksu.ksu.edu (Rich Holland) writes:
  13. >Does anyone know how to make passwd behave non-interactively?  We've tried
  14. >(echo newpass ; echo newpass ) | passwd, but it wants the passwords to be
  15. >typed in from the keyboard.  I need to do this in a script, to set up new
  16. >account passwords...
  17. >
  18.  
  19. If you have "tcl"/"expect" installed, you can use a short "expect" script
  20. like:
  21.  
  22. spawn passwd username
  23. expect "*New Password:"
  24. send "newpass\r"
  25. expect "*Re-type new password:"
  26. send "newpass\r"
  27.  
  28. ...or something like that.
  29.  
  30. Check archie for where to find tcl and expect, and you can read more about
  31. them in comp.lang.tcl. Other options are discussed in the comp.unix.questions
  32. FAQ (q# 3.9, last time I checked).
  33. -- 
  34.       Francisco X DeJesus  ----- S A I C -----  dejesus@chinalake.navy.mil
  35.  ------------------------------------------------------------------------------
  36.   * disclaimer: Opinions expressed here are mine. Typos and errors are yours *
  37.  "Duck Season!" "Rabbit Season!" "...rabbit season." "It's Duck Season! SHOOT!"
  38.