Re: How can I set a password from STDIN?
On Fri, Nov 21, 2003 at 06:42:54AM +0200, Lefteris Tsintjelis wrote: Hi, Would anyone know how can I set or change a password from STDIN? Neither passwd or pw seem to accept STDIN. Use the -h 0 option for pw(8). Check the man pages for more details. -- Jonathan Chen [EMAIL PROTECTED] We laugh in the face of danger, we drop icecubes down the vest of fear - Edmond Blackadder III ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How can I set a password from STDIN?
On Fri, Nov 21, 2003 at 06:42:54AM +0200, Lefteris Tsintjelis wrote: Hi, Would anyone know how can I set or change a password from STDIN? Neither passwd or pw seem to accept STDIN. As someone else mentioned, use -h switch to pw to modify a user password command line using pw. As an example a recent PHP application I worked on I added this as a comment: /* use popen to create a stream to the command: pw adduser -q -u user -g group \ -s shell -d /home/user -c comment -h 0 and then write the password to the file pointer created by popen. This effectively adds the user to the passwd database whilst at same time setting the password. This saves listing the password in 'ps' listings. */ // adduser command: $pw_cmd = $cfg['prog']['pw']. useradd .$data[username] . -g g.$data[id] . -s $shell . -d .$data[root] . -c \.$data[name].\ . -h 0; // Open a uni-directional stream to the command: $fp = popen($pw_cmd, w); // Execute the command, passing the $data[password] to it: fwrite($fp, $data[password]); // Close the pipe: fclose($fp); -- Jez Hancock - System Administrator / PHP Developer http://munk.nu/ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
How can I set a password from STDIN?
Hi, Would anyone know how can I set or change a password from STDIN? Neither passwd or pw seem to accept STDIN. Thank you, Lefteris Tsintjelis ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How can I set a password from STDIN?
On Fri, Nov 21, 2003, Lefteris Tsintjelis wrote: Hi, Would anyone know how can I set or change a password from STDIN? Neither passwd or pw seem to accept STDIN. The ``expect'' program is designed to handle this problem. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 URL: http://www.celestial.com/ ``One of the common failings among honorable people is a failure to appreciate how thoroughly dishonorable some other people can be, and how dangerous it is to trust them.'' - Thomas Sowell ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]