Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ssh2_exec(3) [php man page]

SSH2_EXEC(3)								 1							      SSH2_EXEC(3)

ssh2_exec - Execute a command on a remote server

SYNOPSIS
resource ssh2_exec (resource $session, string $command, [string $pty], [array $env], [int $width = 80], [int $height = 25], [int $width_height_type = SSH2_TERM_UNIT_CHARS]) DESCRIPTION
Execute a command at the remote end and allocate a channel for it. PARAMETERS
o $session - An SSH connection link identifier, obtained from a call to ssh2_connect(3). o $command - o $pty - o $env -$env may be passed as an associative array of name/value pairs to set in the target environment. o $width - Width of the virtual terminal. o $height - Height of the virtual terminal. o $width_height_type -$width_height_type should be one of SSH2_TERM_UNIT_CHARS or SSH2_TERM_UNIT_PIXELS. RETURN VALUES
Returns a stream on success or FALSE on failure. EXAMPLES
Example #1 Executing a command <?php $connection = ssh2_connect('shell.example.com', 22); ssh2_auth_password($connection, 'username', 'password'); $stream = ssh2_exec($connection, '/usr/local/bin/php -i'); ?> SEE ALSO
ssh2_connect(3), ssh2_shell(3), ssh2_tunnel(3). PHP Documentation Group SSH2_EXEC(3)

Check Out this Related Man Page

SSH2_AUTH_HOSTBASED_FILE(3)						 1					       SSH2_AUTH_HOSTBASED_FILE(3)

ssh2_auth_hostbased_file - Authenticate using a public hostkey

SYNOPSIS
bool ssh2_auth_hostbased_file (resource $session, string $username, string $hostname, string $pubkeyfile, string $privkeyfile, [string $passphrase], [string $local_username]) DESCRIPTION
Authenticate using a public hostkey read from a file. PARAMETERS
o $session - An SSH connection link identifier, obtained from a call to ssh2_connect(3). o $username - o $hostname - o $pubkeyfile - o $privkeyfile - o $passphrase - If $privkeyfile is encrypted (which it should be), the passphrase must be provided. o $local_username - If $local_username is omitted, then the value for $username will be used for it. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Authentication using a public hostkey <?php $connection = ssh2_connect('shell.example.com', 22, array('hostkey'=>'ssh-rsa')); if (ssh2_auth_hostbased_file($connection, 'remoteusername', 'myhost.example.com', '/usr/local/etc/hostkey_rsa.pub', '/usr/local/etc/hostkey_rsa', 'secret', 'localusername')) { echo "Public Key Hostbased Authentication Successful "; } else { die('Public Key Hostbased Authentication Failed'); } ?> NOTES
Note ssh2_auth_hostbased_file(3) requires libssh2 >= 0.7 and PHP/SSH2 >= 0.7 PHP Documentation Group SSH2_AUTH_HOSTBASED_FILE(3)
Man Page

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to Execute UNIX Scritp on Remote server

Hi Please suggest me How I can Execute UNIX Scritp on Remote server. Thanks Sourabh (2 Replies)
Discussion started by: sourabhshakya
2 Replies

2. Shell Programming and Scripting

Execute command from terminal on remote machine

Hi All, I want to execute some commands on unix machine from the mac machne. I have two options for doing so, I am confused which is the best way of doing. Here are two options. Requirement: Execute command on the remote server machine. Commands to be executed itself contain arguments to be... (0 Replies)
Discussion started by: Ranu
0 Replies

3. Shell Programming and Scripting

problem with sshpass

Hello i am using sshpass to pass remote password into script but phase some problems when try to execute some commands remotely which means that the remote env not passed through sshpass for example sshpass -p 'XXX' ssh -o StrictHostKeyChecking=no -l myserver myserver visu_fis_pnes ... (2 Replies)
Discussion started by: mogabr
2 Replies

4. Shell Programming and Scripting

Establishing remote connection to a Xserver from a UNIX Box

Hello Guys , I have been working on a script where we are looking to connect a remote Xserver from a Unix box. Once a connection is made , i need to run several commands on remote machine to check various stuffs. As per my knowledge on unix (which is like a drop in ocean) , i found SSH as a... (7 Replies)
Discussion started by: himanshu sood
7 Replies