dodul Posted November 27, 2012 Share Posted November 27, 2012 Hi, I have the below code to get tput from a remote server, $connection = ssh2_connect('x.x.x.x', 22 ); if( !$connection )die( 'Can not Connect' ); if( ssh2_auth_password( $connection, 'user', 'pass' ) ) { echo "Password Correct<br/>"; }else{ echo "Password Wrong<br/>"; } $out = ssh2_exec( $connection, 'ls '); echo $out; $err_stream = ssh2_fetch_stream( $out, SSH2_STREAM_STDERR ); $result_err = stream_get_contents( $err_stream ); echo $result_err; stream_set_blocking( $out, true ); while( $line = fgets($out) ){ flush(); echo $line; $content.=$line; } This code runs and outputs perfectly to my server if connected to the root user account. However, if I try to connect to other user accounts no output is shown. Again if I connect to my server using putty to the same user account and exicute the same command it shows output. Can anyone give me idea what can be the possible issue for this? Thanks in advanced. Quote Link to comment https://forums.phpfreaks.com/topic/271245-having-probelm-with-ssh2_exec/ 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.