funstein Posted September 8, 2011 Share Posted September 8, 2011 Hello, I am developing an account manager for our local network and I want people to be able to login to my website and change their UNIX & Mailbox password. These people have SSH access so that is why the UNIX passwd should also be changed. So what I want to do is get the values $username, $currentpwd , $newpwd and $newpwdcnfrm from the HTML form and execute the following shell commands : su -l $username passwd Enter current UNIX Passwd : $currentpwd Enter new UNIX Passwd : $newpwd Confirm UNIX Passwd : $newpwdcnfrm The problem here is, passwd takes old and new passwords as input, not as command parameters. So I cant just do shell_exec("passwd $currentpwd $newpwd $newpwdcnfrm") ; Do you guys know how to give input to the command? Thx. Btw : Please do not argue about the security issues. I am aware of everything and I am perfectly sure that the script will run securely. Link to comment https://forums.phpfreaks.com/topic/246696-shell-execution-in-php/ Share on other sites More sharing options...
trq Posted September 8, 2011 Share Posted September 8, 2011 Take a look at the Expect extension: http://www.php.net/manual/en/book.expect.php Link to comment https://forums.phpfreaks.com/topic/246696-shell-execution-in-php/#findComment-1266821 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.