Jump to content

Shell execution in PHP


funstein

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.