array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.ssh2-auth-password.php', 1 => 'ssh2_auth_password', ), 'up' => array ( 0 => 'ref.ssh2.php', 1 => 'SSH2 函数', ), 'prev' => array ( 0 => 'function.ssh2-auth-none.php', 1 => 'ssh2_auth_none', ), 'next' => array ( 0 => 'function.ssh2-auth-pubkey-file.php', 1 => 'ssh2_auth_pubkey_file', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ssh2/functions/ssh2-auth-password.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL ssh2 >= 0.9.0)
ssh2_auth_password — Authenticate over SSH using a plain password
Authenticate over SSH using a plain password. Since version 0.12 this function also supports keyboard_interactive method.
session
An SSH connection link identifier, obtained from a call to ssh2_connect().
username
Remote user name.
password
Password for username
示例 #1 Authenticating with a password
<?php
$connection = ssh2_connect('shell.example.com', 22);
if (ssh2_auth_password($connection, 'username', 'secret')) {
echo "Authentication Successful!\n";
} else {
die('Authentication Failed...');
}
?>