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? 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. 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? 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. 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 Link to comment https://forums.phpfreaks.com/topic/251172-ssh2-help/#findComment-1288311 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.