SSH2_SHELL(3) 1 SSH2_SHELL(3)ssh2_shell - Request an interactive shellSYNOPSIS
resource ssh2_shell (resource $session, [string $term_type = "vanilla"], [array $env], [int $width = 80], [int $height = 25], [int
$width_height_type = SSH2_TERM_UNIT_CHARS])
DESCRIPTION
Open a shell at the remote end and allocate a stream for it.
PARAMETERS
o $session
- An SSH connection link identifier, obtained from a call to ssh2_connect(3).
o $term_type
-$term_type should correspond to one of the entries in the target system's /etc/termcap file.
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 EXAMPLES
Example #1
Executing a command
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$stream = ssh2_shell($connection, 'vt102', null, 80, 24, SSH2_TERM_UNIT_CHARS);
?>
SEE ALSO ssh2_exec(3), ssh2_tunnel(3), ssh2_fetch_stream(3).
PHP Documentation Group SSH2_SHELL(3)
Check Out this Related Man Page
SSH2_AUTH_PUBKEY_FILE(3) 1 SSH2_AUTH_PUBKEY_FILE(3)ssh2_auth_pubkey_file - Authenticate using a public keySYNOPSIS
bool ssh2_auth_pubkey_file (resource $session, string $username, string $pubkeyfile, string $privkeyfile, [string $passphrase])
DESCRIPTION
Authenticate using a public key read from a file.
PARAMETERS
o $session
- An SSH connection link identifier, obtained from a call to ssh2_connect(3).
o $username
-
o $pubkeyfile
- The public key file needs to be in OpenSSH's format. It should look something like: ssh-rsa AAAAB3NzaC1yc2EAAA....NX6sqSnHA8=
rsa-key-20121110
o $privkeyfile
-
o $passphrase
- If $privkeyfile is encrypted (which it should be), the $passphrase must be provided.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Authentication using a public key
<?php
$connection = ssh2_connect('shell.example.com', 22, array('hostkey'=>'ssh-rsa'));
if (ssh2_auth_pubkey_file($connection, 'username',
'/home/username/.ssh/id_rsa.pub',
'/home/username/.ssh/id_rsa', 'secret')) {
echo "Public Key Authentication Successful
";
} else {
die('Public Key Authentication Failed');
}
?>
NOTES
Note
The underlying libssh library doesn't support partial auths very cleanly That is, if you need to supply both a public key and a
password it will appear as if this function has failed. In this particular case a failure from this call may just mean that auth
hasn't been completed yet. You would need to ignore this failure and continue on and call ssh2_auth_password(3) in order to complete
authentication.
PHP Documentation Group SSH2_AUTH_PUBKEY_FILE(3)
Hi,
Now that I'm going to be using my Mac as a web host, I decided to use the PHP shell.
However, when I type php straight in the terminal, the session freezes.
Is there anything wrong that I'm doing? (3 Replies)
Hi
I'm trying to create a connection with DB from shell script using the following string
sqlplus <user>@<db_instance>/<password>
in which I'm successful.
However, after connecting to DB it is giving me a sql prompt as follows
=====================
Connected to:
Oracle Database 10g... (2 Replies)
Dears,
Newbie here and tried to search this topic for 3 days now with results.
I have a shell array and I want to use it in sqlplus with one connection.
here is what I have for now
#!/bin/ksh
FileName=1000
FileName=2000
FileName=3000
FileName=4000
sqlplus /nolog <<EOF
connect... (20 Replies)
Hi, Here is the issue: Any SSH connection to this server drops in 5 minutes.
# date
Wed Jul 18 17:11:27 GMT 2012 (Note: use GMT)
# grep Alive /etc/ssh/sshd_config
#TCPKeepAlive yes
ClientAliveInterval 60
ClientAliveCountMax 100
# ssh -V
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul... (9 Replies)