Expand|Select|Wrap|Line Numbers
- $connection = ssh2_connect('Relay.com', 22);
- if (!$connection)
- {
- die("Connection failed");
- }
- else
- {
- echo "connect OK";
- }
- if (!ssh2_auth_password($connection, 'username', 'password'))
- {
- die("Auth failed");
- }
- else
- {
- echo "login OK";
- }
Expand|Select|Wrap|Line Numbers
- $cmd="ssh root@10.*.*.*";
- ssh2_exec($connection,$cmd);
- sleep(10);
- $cmd="spassword";
- ssh2_exec($connection,$cmd);
connect OKlogin OK
Warning: ssh2_exec(): Unable to request command execution on remote host