PHP Help
#4

Expect allows you to "feed" the password to the passwd command.

http://linux.die.net/man/5/passwd
http://linux.die.net/man/1/expect

EDIT: Small script that might help
Код:
#!/usr/bin/expect -f
spawn passwd [lindex $argv 0]
set pass [lindex $argv 1]
expect {
        password: {send "$pass\r" ; exp_continue}
        eof exit
}
Place this script in /usr/bin and name it setpasswd. You can then call the command setpasswd username password in your PHP function or exec().
Reply


Messages In This Thread
PHP Help - by ћNJ - 20.07.2011, 10:56
Re: PHP Help - by linuxthefish - 20.07.2011, 10:59
Re: PHP Help - by ћNJ - 20.07.2011, 11:01
Re: PHP Help - by linuxthefish - 20.07.2011, 11:05
Re: PHP Help - by ћNJ - 20.07.2011, 11:08
Re: PHP Help - by linuxthefish - 20.07.2011, 11:10
Re: PHP Help - by ћNJ - 20.07.2011, 11:16
Re: PHP Help - by Vipero - 20.07.2011, 11:17
Re: PHP Help - by ћNJ - 20.07.2011, 11:19
Re: PHP Help - by linuxthefish - 20.07.2011, 11:24

Forum Jump:


Users browsing this thread: 3 Guest(s)