📄 function.ssh2-connect.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Connect to an SSH server</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ssh2-auth-pubkey-file.html">ssh2_auth_pubkey_file</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ssh2-exec.html">ssh2_exec</a></div> <div class="up"><a href="ref.ssh2.html">SSH2 Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.ssh2-connect" class="refentry"> <div class="refnamediv"> <h1 class="refname">ssh2_connect</h1> <p class="verinfo">(PECL ssh2:0.10-0.9)</p><p class="refpurpose"><span class="refname">ssh2_connect</span> — <span class="dc-title">Connect to an SSH server</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">resource</span> <span class="methodname"><b><b>ssh2_connect</b></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$host</tt></span> [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$port</tt></span> [, <span class="methodparam"><span class="type">array</span> <tt class="parameter">$methods</tt></span> [, <span class="methodparam"><span class="type">array</span> <tt class="parameter">$callbacks</tt></span> ]]] )</div> <p class="para rdfs-comment"> Establish a connection to a remote SSH server. </p> <p class="para"> Once connected, the client should verify the server's hostkey using <a href="function.ssh2-fingerprint.html" class="function">ssh2_fingerprint()</a>, then authenticate using either password or public key. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">host</tt></i></span> <dd> <p class="para"> </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">port</tt></i></span> <dd> <p class="para"> </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">methods</tt></i></span> <dd> <p class="para"> <i><tt class="parameter">methods</tt></i> may be an associative array with up to four parameters as described below. </p> <p class="para"> <table border="5"> <caption><b><i><tt class="parameter">methods</tt></i> may be an associative array with any or all of the following parameters.</b></caption> <colgroup> <thead valign="middle"> <tr valign="middle"> <th colspan="1">Index</th> <th colspan="1">Meaning</th> <th colspan="1">Supported Values*</th> </tr> </thead> <tbody valign="middle" class="tbody"> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">kex</td> <td colspan="1" rowspan="1" align="left"> List of key exchange methods to advertise, comma separated in order of preference. </td> <td colspan="1" rowspan="1" align="left"> <i>diffie-hellman-group1-sha1</i>, <i>diffie-hellman-group14-sha1</i>, and <i>diffie-hellman-group-exchange-sha1</i> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">hostkey</td> <td colspan="1" rowspan="1" align="left"> List of hostkey methods to advertise, come separated in order of preference. </td> <td colspan="1" rowspan="1" align="left"> <i>ssh-rsa</i> and <i>ssh-dss</i> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">client_to_server</td> <td colspan="1" rowspan="1" align="left"> Associative array containing crypt, compression, and message authentication code (MAC) method preferences for messages sent from client to server. </td> <td class="empty"> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">server_to_client</td> <td colspan="1" rowspan="1" align="left"> Associative array containing crypt, compression, and message authentication code (MAC) method preferences for messages sent from client to server. </td> <td class="empty"> </td> </tr> </tbody> </colgroup> </table> </p> <p class="para"> * - Supported Values are dependent on methods supported by underlying library. See <a href="http://sourceforge.net/projects/libssh2/" class="link external">» libssh2</a> documentation for additional information. </p> <p class="para"> <table border="5"> <caption><b> <i><tt class="parameter">client_to_server</tt></i> and <i><tt class="parameter">server_to_client</tt></i> may be an associative array with any or all of the following parameters. </b></caption> <colgroup> <thead valign="middle"> <tr valign="middle"> <th colspan="1">Index</th> <th colspan="1">Meaning</th> <th colspan="1">Supported Values*</th> </tr> </thead> <tbody valign="middle" class="tbody"> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">crypt</td> <td colspan="1" rowspan="1" align="left">List of crypto methods to advertise, comma separated in order of preference.</td> <td colspan="1" rowspan="1" align="left"> <i>rijndael-cbc@lysator.liu.se</i>, <i>aes256-cbc</i>, <i>aes192-cbc</i>,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -