Hi all,
I am following this thread by what its not working.
Quote:
You really don't need a perl script. All you need is following shell script and expect tool:
Add following lines to it:
Code:
#!/bin/sh
# \
exec expect -f "$0" ${1+"$@"}
set password [lindex $argv 1]
spawn passwd [lindex $argv 0]
expect "assword:"
send "$password\r"
expect "assword:"
send "$password\r"
expect eof
To change password for user vivek:
Code:
npasswd vivek 123456
Where,
npasswd : script name
vivek : username
123456: Newpassword
Script must be run as a root user, it can be call from perl, php or any other lanauge. Download expect tool here: Expect - Expect - Home Page
|
it works from command line but when put it in php page it doesn't. For that I followed this link.
Change Linux or UNIX system password using PHP script | nixCraft
But it doesn't work.