File: ssh2.xml

package info (click to toggle)
php-doc 20241205~git.dfcbb86%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 70,956 kB
  • sloc: xml: 968,269; php: 23,883; javascript: 671; sh: 177; makefile: 37
file content (301 lines) | stat: -rw-r--r-- 8,857 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->

<refentry xml:id="wrappers.ssh2" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" annotations="verify_info:false" role="stream_wrapper">
 <refnamediv>
  <refname>ssh2://</refname>
  <refpurpose>Secure Shell 2</refpurpose>
 </refnamediv>

 <refsect1 role="description"><!-- {{{ -->
  &reftitle.description;
  <para>
   <filename>ssh2.shell://</filename>
   <filename>ssh2.exec://</filename>
   <filename>ssh2.tunnel://</filename>
   <filename>ssh2.sftp://</filename>
   <filename>ssh2.scp://</filename>
   (PECL)
  </para>

  <note>
   <title>This wrapper is not enabled by default</title>
   <simpara>
    In order to use the <filename>ssh2.*://</filename> wrappers,
    the
    <link xlink:href="&url.pecl.package;ssh2">SSH2</link>
    extension available from &link.pecl; must be installed.
   </simpara>
  </note>

  <simpara>
   In addition to accepting traditional URI login details, the ssh2 wrappers
   will also reuse open connections by passing the connection resource in the
   host portion of the URL.
  </simpara>
 </refsect1><!-- }}} -->

 <refsect1 role="usage"> <!-- {{{ -->
  &reftitle.usage;
  <itemizedlist>
   <listitem><simpara><filename>ssh2.shell://user:pass@example.com:22/xterm</filename></simpara></listitem>
   <listitem><simpara><filename>ssh2.exec://user:pass@example.com:22/usr/local/bin/somecmd</filename></simpara></listitem>
   <listitem><simpara><filename>ssh2.tunnel://user:pass@example.com:22/192.168.0.1:14</filename></simpara></listitem>
   <listitem><simpara><filename>ssh2.sftp://user:pass@example.com:22/path/to/filename</filename></simpara></listitem>
  </itemizedlist>
 </refsect1> <!-- }}} -->

 <refsect1 role="options"><!-- {{{ -->
  &reftitle.options;
  <para>
   <table>
    <title>Wrapper Summary</title>
    <tgroup cols="6">
     <thead>
      <row>
       <entry>Attribute</entry>
       <entry>ssh2.shell</entry>
       <entry>ssh2.exec</entry>
       <entry>ssh2.tunnel</entry>
       <entry>ssh2.sftp</entry>
       <entry>ssh2.scp</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>Restricted by <link linkend="ini.allow-url-fopen">allow_url_fopen</link></entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
      </row>
      <row>
       <entry>Allows Reading</entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
      </row>
      <row>
       <entry>Allows Writing</entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
       <entry>No</entry>
      </row>
      <row>
       <entry>Allows Appending</entry>
       <entry>No</entry>
       <entry>No</entry>
       <entry>No</entry>
       <entry>Yes (When supported by server)</entry>
       <entry>No</entry>
      </row>
      <row>
       <entry>Allows Simultaneous Reading and Writing</entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
       <entry>Yes</entry>
       <entry>No</entry>
      </row>
      <row>
       <entry>Supports <function>stat</function></entry>
       <entry>No</entry>
       <entry>No</entry>
       <entry>No</entry>
       <entry>Yes</entry>
       <entry>No</entry>
      </row>
      <row>
       <entry>Supports <function>unlink</function></entry>
       <entry>No</entry>
       <entry>No</entry>
       <entry>No</entry>
       <entry>Yes</entry>
       <entry>No</entry>
      </row>
      <row>
       <entry>Supports <function>rename</function></entry>
       <entry>No</entry>
       <entry>No</entry>
       <entry>No</entry>
       <entry>Yes</entry>
       <entry>No</entry>
      </row>
      <row>
       <entry>Supports <function>mkdir</function></entry>
       <entry>No</entry>
       <entry>No</entry>
       <entry>No</entry>
       <entry>Yes</entry>
       <entry>No</entry>
      </row>
      <row>
       <entry>Supports <function>rmdir</function></entry>
       <entry>No</entry>
       <entry>No</entry>
       <entry>No</entry>
       <entry>Yes</entry>
       <entry>No</entry>
      </row>
     </tbody>
    </tgroup>
   </table>
  </para>


  <!-- FIXME: This should be context.ssh2!!! -->
  <para>
   <table>
    <title>Context options</title>
    <tgroup cols="3">
     <thead>
      <row>
       <entry>Name</entry>
       <entry>Usage</entry>
       <entry>Default</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry><literal>session</literal></entry>
       <entry>Preconnected ssh2 resource to be reused</entry>
       <entry/>
      </row>
      <row>
       <entry><literal>sftp</literal></entry>
       <entry>Preallocated sftp resource to be reused</entry>
       <entry/>
      </row>
      <row>
       <entry><literal>methods</literal></entry>
       <entry>Key exchange, hostkey, cipher, compression, and MAC methods to use</entry>
       <entry/>
      </row>
      <row>
       <entry><literal>callbacks</literal></entry>
       <entry></entry>
       <entry></entry>
      </row>
      <row>
       <entry><literal>username</literal></entry>
       <entry>Username to connect as</entry>
       <entry></entry>
      </row>
      <row>
       <entry><literal>password</literal></entry>
       <entry>Password to use with password authentication</entry>
       <entry></entry>
      </row>
      <row>
       <entry><literal>pubkey_file</literal></entry>
       <entry>Name of public key file to use for authentication</entry>
       <entry></entry>
      </row>
      <row>
       <entry><literal>privkey_file</literal></entry>
       <entry>Name of private key file to use for authentication</entry>
       <entry></entry>
      </row>
      <row>
       <entry><literal>env</literal></entry>
       <entry>Associate array of environment variables to set</entry>
       <entry></entry>
      </row>
      <row>
       <entry><literal>term</literal></entry>
       <entry>Terminal emulation type to request when allocating a pty</entry>
       <entry></entry>
      </row>
      <row>
       <entry><literal>term_width</literal></entry>
       <entry>Width of terminal requested when allocating a pty</entry>
       <entry></entry>
      </row>
      <row>
       <entry><literal>term_height</literal></entry>
       <entry>Height of terminal requested when allocating a pty</entry>
       <entry></entry>
      </row>
      <row>
       <entry><literal>term_units</literal></entry>
       <entry>Units to use with term_width and term_height</entry>
       <entry><constant>SSH2_TERM_UNIT_CHARS</constant></entry>
      </row>
     </tbody>
    </tgroup>
   </table>
  </para>
 </refsect1> <!-- }}} -->

 <refsect1 role="examples"><!-- {{{ -->
  &reftitle.examples;
  <example>
   <title>Opening a stream from an active connection</title>
   <programlisting role="php">
<![CDATA[
<?php
$session = ssh2_connect('example.com', 22);
ssh2_auth_pubkey_file($session, 'username', '/home/username/.ssh/id_rsa.pub',
                                            '/home/username/.ssh/id_rsa', 'secret');
$stream = fopen("ssh2.tunnel://$session/remote.example.com:1234", 'r');
?>
]]>
   </programlisting>
  </example>
  <example>
   <title>This <varname>$session</varname> variable must be kept available!</title>
   <simpara>
    In order to use the <filename>ssh2.*://$session</filename> wrappers,
    the <varname>$session</varname> resource variable must be kept.
    The code below will not have the desired effect:
   </simpara>
   <programlisting role="php">
<![CDATA[
<?php
$session = ssh2_connect('example.com', 22);
ssh2_auth_pubkey_file($session, 'username', '/home/username/.ssh/id_rsa.pub',
                                            '/home/username/.ssh/id_rsa', 'secret');
$connection_string = "ssh2.sftp://$session/";
unset($session);
$stream = fopen($connection_string . "path/to/file", 'r');
?>
]]>
   </programlisting>
   <simpara>
    unset() closes the session, because <varname>$connection_string</varname> does not
    hold a reference to the <varname>$session</varname> variable, just a string cast
    derived from it. This also happens when the <function>unset</function> is implicit
    because of leaving scope (like in a function).
   </simpara>
  </example>

 </refsect1><!-- }}} -->

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->