phpcs Posted November 15, 2011 Share Posted November 15, 2011 I'm using php ssh2 extension to run commands on remote servers from my php script. But there are many commands that require authentication, like "passwd", other commands like "ls -l" are fine with no problem, How can I use ssh2 to run this kind of commands? Quote Link to comment https://forums.phpfreaks.com/topic/251172-ssh2-help/ Share on other sites More sharing options...
trq Posted November 15, 2011 Share Posted November 15, 2011 If your commands require user interaction you can use expect. ps: passwd does not require any user interaction. Quote Link to comment https://forums.phpfreaks.com/topic/251172-ssh2-help/#findComment-1288285 Share on other sites More sharing options...
phpcs Posted November 15, 2011 Author Share Posted November 15, 2011 Thanks, But no, my script doesn't require to interact with user, Let me make a better example, I'm using commands like mysql or sftp .... which are not just one command, when we execute them on a remote server always server asks about authenication criteria so this commands are not just one step commands, How to be able running these commands via ssh2 abilities? or any other alternative? Quote Link to comment https://forums.phpfreaks.com/topic/251172-ssh2-help/#findComment-1288288 Share on other sites More sharing options...
trq Posted November 15, 2011 Share Posted November 15, 2011 As I said, use expect, that is exactly what I meant by user interaction. Quote Link to comment https://forums.phpfreaks.com/topic/251172-ssh2-help/#findComment-1288289 Share on other sites More sharing options...
phpcs Posted November 15, 2011 Author Share Posted November 15, 2011 Thanks thorpe, That was great help of you. Regards Quote Link to comment https://forums.phpfreaks.com/topic/251172-ssh2-help/#findComment-1288311 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.