sndpkol Posted January 29, 2013 Share Posted January 29, 2013 Hi ALL, I m using a Php program ,which on click triggers a shell script ,with in which it try to ssh to remote host and login.. to pass the password for ssh to remote host ,i m using expect script(whihc supplies the password) when i run this script through shell command line it works perfectly.but when i use the php web program it is not working .the expect script triggers ssh to remote host but password is not supplied . expect script which is triggered by shell script #!/usr/bin/expect spawn ssh -t IPAddress expect "*?assword:*" send "password\r" interact PHP script <?php passthru('/<pathto script>/wrapper.exp>wrapper.log'); ?> ~ the above php is triggered by html for on click Thanks in advance Regards, Sandeep M Link to comment https://forums.phpfreaks.com/topic/273772-problem-ssh-login-from-php-webapp-using-expect-script/ Share on other sites More sharing options...
kicken Posted January 29, 2013 Share Posted January 29, 2013 I'm not to familiar with expect, so I can't help much there. However I have a few alternative suggestions you could implement instead of using expect: a) Try using the SSH2 extension for PHP to connect and do what you need from within PHP rather than attempting to exec() an external utility or b) Setup public-key based authentication to allow you to login without needing to enter in a password. Link to comment https://forums.phpfreaks.com/topic/273772-problem-ssh-login-from-php-webapp-using-expect-script/#findComment-1408957 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.