From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,92eab93e67c80b9b X-Google-Attributes: gidfee84,public From: Paul A Sand Subject: Re: change user's password in shell Date: 2000/03/27 Message-ID: <8bn9lo$vmf$1@tabloid.unh.edu>#1/1 X-Deja-AN: 602882157 References: <0724ac5b.08a67ae9@usw-ex0108-062.remarq.com> X-Complaints-To: usenet@tabloid.unh.edu X-Trace: tabloid.unh.edu 954149368 32463 132.177.139.166 (27 Mar 2000 09:29:28 GMT) Organization: University of New Hampshire Reply-To: pas@unh.edu NNTP-Posting-Date: 27 Mar 2000 09:29:28 GMT Newsgroups: comp.unix.osf.osf1 keel writes: >It there any way to change user's password in a shell >program? >It must base the " passwd " command,for i am use digital >unix and have no other command to change user's password If you want to write a shell wrapper around `passwd' that users can run, then I think most people might point you to the `expect' program, which deals properly with calling inherently interactive programs like passwd from a script. You can find out about expect at http://expect.nist.gov/ If you (as root) want to change people's passwords, then calling /usr/sbin/vipw from your shell script is another possibility. In your script, set the EDITOR environment variable to /bin/ed, open a pipe to /usr/sbin/vipw, and send down the appropriate ed commands to replace the user's password field with the encrypted password of your choice. You of course need to be really careful with your ed commands to avoid corrupting the file. -- -- Paul A. Sand | My list of what does not work is only -- University of New Hampshire | 1543662 bytes right now. It is not complete, -- pas@unh.edu | but does provide a good start. -- http://pubpages.unh.edu/~pas | (Mike Stump, in gnu.g++.bug)