Advertisement
Guest User

Untitled

a guest
Sep 6th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. $ip = '123.12.123.123';
  2. $user = 'root';
  3. $pass = 'pass';
  4.  
  5. $conn = ssh2_connect($ip);
  6. ssh2_auth_password($conn, $user, $pass);
  7.  
  8. $stream = ssh2_exec($conn, 'whoami');
  9. stream_set_blocking($stream, true);
  10.  
  11. echo stream_get_contents($stream); // root
  12.  
  13. // INSTALL EXTENSION -
  14. // > sudo apt-get install libssh2-php
  15. // > sudo /etc/init.d/apache2 restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement