i think you'd have an easier time if you used phpseclib, a pure PHP SFTP implementation. eg. <?php include('Net/SFTP.php'); $sftp = new Net_SFTP('www.domain.tld'); if (!$sftp->login('username', 'password')) { exit('Login Failed'); } // puts a three-byte file named filename.remote on the SFTP server $sftp->put('filename.remote', 'xxx'); // puts an x-byte file named filename.remote...

Closing an SSH channel properly involves more steps than just "closing it" on one side. First, the documentation for libssh2_channel_close() says it sends "an SSH_MSG_CLOSE packet to the remote host which serves as instruction that no further data will be sent to it", which is OK, but also that "the...

If you want to build library with libgcrypt https://github.com/x2on/libgcrypt-for-ios.git Download this code and copy in source file you have downloaded from link of LIBSSH2. OR you can clone it too as suggested steps in above link. Need to follow same steps with openssl too, if you want to build it...

You have to parse the stream output for the sudo prompt. At that point, you have to stream.write(password + '\n');. The alternative to doing all of that is to modify /etc/sudoers so that the logged in user can execute sudo for a specific program/script/whatever without a password.

I did this before and was simply using the SSH command directly. For example: $sshCmd = "ssh [email protected] \"ls -la ~\""; exec($sshCmd, $output, $errorCode); echo "Error code: $errorCode\n"; echo "Output: " . implode("\n", $output); If you have more complex scripts to run, you can put then in a .sh script...