Page 1 of 1

How to change Linux user password from PHP code?

Posted: Thu Jun 05, 2003 1:26 am
by vinod_bujji
hi
I want to change the password of the linux/unix user. For e.g In my linux system the user name is "vinod" and the password is "vinod12". Please can anyone give me the solution to change the password of the linux user from PHP code. I want to change it through programatically using PHP . If anyone can help me or give me the solution i will be very thankful to u friends. Can anyone give me some steps inthe form of phpfile please?
with regards
vinod

Posted: Thu Jun 05, 2003 1:56 am
by r337ard
its almost totally unlikely you'd be able to do that with php, because its permission set is unable to read the password file in a unix environment. php would need to be run under a group account that had this access, which means no shared host worth its servers would have this set up. if you installed php yourself on your own linux box, you could assign its group permission to access whatever file your linux passwords are stored in.

then its possible

Posted: Thu Jun 05, 2003 2:03 am
by []InTeR[]
search gave me this:
this

Posted: Thu Jun 05, 2003 2:48 am
by r337ard
Let your program connect on the telnet port, logon with root....
And just change the pass....
interesting workaround :)

Posted: Thu Jun 05, 2003 2:59 am
by []InTeR[]
Hey, it works for me... :)

Posted: Thu Jun 05, 2003 9:01 am
by Stoker
Changing your own account password (the same account as the owner of the php-files being processed) is possible, if the Apache server is suexec enabled, make a 0700 permitted script and it will run as your own user and you can now run the passwd command... Most (sane) systems and cgi-wrappers wont allow doing this as root..

A different approach would be to have the script add an entry to a file or a database an dthen make a cron-job that checks this database and performs the queued commands, a great deal of caution and security aware thinking should be a part of it..

Solution?

Posted: Thu Nov 20, 2003 5:24 pm
by terfle
Does anyone have a script written that does this?

I've looked everywhere and haven't found one written in PHP, if anyone has this please let me know.

Anybody??

Posted: Fri Nov 21, 2003 11:35 am
by terfle
Anybody, any ideas? :?

Posted: Fri Nov 21, 2003 1:46 pm
by Stoker
My idea as posted above would work... one script posts to a file, a cron-job (scheduler) does the actual change...