File: chapter-1.html

package info (click to toggle)
libnet-ssh-ruby 1.1.2-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,472 kB
  • ctags: 2,465
  • sloc: ruby: 10,848; makefile: 17
file content (388 lines) | stat: -rw-r--r-- 14,772 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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<html>
  <head>
    <title>Net::SSH Manual :: Chapter 1: Introduction</title>
    <link type="text/css" rel="stylesheet" href="stylesheets/manual.css" />
  </head>
  
  <body>
    <div id="banner">
      <table border='0' cellpadding='0' cellspacing='0' width='100%'>
        <tr><td valign='top' align='left'>
          <div class="title">
            <span class="product">Net::SSH&mdash;</span><br />
            <span class="tagline">Secure Shell for Ruby</span>
          </div>
        </td><td valign='middle' align='right'>
          <div class="info">
            Net::SSH Version: <strong>1.1.2</strong><br />
            Manual Last Updated: <strong>2007-06-18 18:12 UTC</strong>
          </div>
        </td></tr>
      </table>
    </div>

    <table border='0' width='100%' cellpadding='0' cellspacing='0'>
      <tr><td valign='top'>

        <div id="navigation">
          <h1>Net::SSH Manual</h1>

          <h2>Chapters</h2>
          <ol type="I">
          
            <li><strong>
                <a href="chapter-1.html">
                Introduction
                </a>
                </strong> <big>&larr;</big>
              <ol type="1">
                
                  <li><a href="chapter-1.html#s1">What is Net::SSH?</a></li>
                
                  <li><a href="chapter-1.html#s2">What isn&#8217;t Net::SSH?</a></li>
                
                  <li><a href="chapter-1.html#s3">Getting Net::SSH</a></li>
                
                  <li><a href="chapter-1.html#s4">License Information</a></li>
                
                  <li><a href="chapter-1.html#s5">Support</a></li>
                
                  <li><a href="chapter-1.html#s6">About the Author</a></li>
                
              </ol>
            </li>
          
            <li>
                <a href="chapter-2.html">
                Starting a Session
                </a>
                
              <ol type="1">
                
                  <li><a href="chapter-2.html#s1">Using Net::SSH.start</a></li>
                
                  <li><a href="chapter-2.html#s2">Using a Public/Private Key</a></li>
                
                  <li><a href="chapter-2.html#s3">Options</a></li>
                
                  <li><a href="chapter-2.html#s4">Using Net::SSH::Session</a></li>
                
              </ol>
            </li>
          
            <li>
                <a href="chapter-3.html">
                Channels
                </a>
                
              <ol type="1">
                
                  <li><a href="chapter-3.html#s1">What are Channels?</a></li>
                
                  <li><a href="chapter-3.html#s2">Session.loop</a></li>
                
                  <li><a href="chapter-3.html#s3">Channel Types</a></li>
                
                  <li><a href="chapter-3.html#s4">Opening a Channel</a></li>
                
                  <li><a href="chapter-3.html#s5">Callbacks</a></li>
                
                  <li><a href="chapter-3.html#s6">Channel Operations</a></li>
                
              </ol>
            </li>
          
            <li>
                <a href="chapter-4.html">
                Executing Commands
                </a>
                
              <ol type="1">
                
                  <li><a href="chapter-4.html#s1">Using Channels</a></li>
                
                  <li><a href="chapter-4.html#s2">Using #process.open</a></li>
                
                  <li><a href="chapter-4.html#s3">Using #process.popen3</a></li>
                
              </ol>
            </li>
          
            <li>
                <a href="chapter-5.html">
                User Shells
                </a>
                
              <ol type="1">
                
                  <li><a href="chapter-5.html#s1">Introduction</a></li>
                
                  <li><a href="chapter-5.html#s2">Using Channels</a></li>
                
                  <li><a href="chapter-5.html#s3">Shell Service</a></li>
                
                  <li><a href="chapter-5.html#s4">SyncShell Service</a></li>
                
                  <li><a href="chapter-5.html#s5">Terminal Clients</a></li>
                
              </ol>
            </li>
          
            <li>
                <a href="chapter-6.html">
                Port Forwarding
                </a>
                
              <ol type="1">
                
                  <li><a href="chapter-6.html#s1">Introduction</a></li>
                
                  <li><a href="chapter-6.html#s2">Local-to-Remote</a></li>
                
                  <li><a href="chapter-6.html#s3">Remote-to-Local</a></li>
                
                  <li><a href="chapter-6.html#s4">Direct Channels</a></li>
                
                  <li><a href="chapter-6.html#s5">Remote-to-Local Handlers</a></li>
                
              </ol>
            </li>
          
            <li>
                <a href="chapter-7.html">
                Using Proxies
                </a>
                
              <ol type="1">
                
                  <li><a href="chapter-7.html#s1">Introduction</a></li>
                
                  <li><a href="chapter-7.html#s2"><span class="caps">HTTP</span></a></li>
                
                  <li><a href="chapter-7.html#s3"><span class="caps">SOCKS</span></a></li>
                
              </ol>
            </li>
          
          </ol>

          <h2>Other Documentation</h2>

          <ul>
            <li><a href="http://net-ssh.rubyforge.org/api/index.html">Net::SSH API</a></li>
            <li><a href="http://rubyforge.org/tracker/?atid=1842&group_id=274&func=browse">Net::SSH FAQ</a></li>
          </ul>

          <h2>Tutorials</h2>
          <ol>
          
          </ol>

          <p align="center"><strong>More To Come...</strong></p>

          <div class="license">
            <a href="http://creativecommons.org/licenses/by-sa/2.0/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights" /></a><br />
            This manual is licensed under a <a href="http://creativecommons.org/licenses/by-sa/2.0/">Creative Commons License</a>.
          </div>
        </div>

      </td><td valign='top' width="100%">

        <div id="content">

           <div class="top"><div class="prevnext">
  
  <a href="index.html">Up</a>
  
    | <a href="chapter-2.html">Next (2. Starting a Session)</a>
  
</div></div>

<h1>1. Introduction</h1>



     <h2>
       <a name="s1"></a>
       1.1. What is Net::SSH?
     </h2>

   

   <div class="section">
     <p>Net::SSH is a pure-Ruby implementation of the <span class="caps">SSH2</span> client protocol. It supports the following features:</p>


	<ul>
	<li>User authentication via explicit username/password, or using a public-key/private-key pair.</li>
		<li>Port forwarding, both from the local host to a remote computer via the remote host, and from the remote host to the local host.</li>
		<li>Execute processes on the remote machine, both interactively and non-interactively (&#8220;batch&#8221;).</li>
	</ul>
   </div>



     <h2>
       <a name="s2"></a>
       1.2. What isn&#8217;t Net::SSH?
     </h2>

   

   <div class="section">
     <p>Net::SSH is only a <em>client</em> implementation, not a server. Given sufficient motivation and encouragement from the community, perhaps it will someday include an <span class="caps">SSH</span> server, but as of right now, it does not.</p>


	<p>Furthermore, it is only an <em><span class="caps">SSH2</span></em> client. This means that it cannot connect to <span class="caps">SSH</span> servers that only understand the older <span class="caps">SSH1</span> protocol.</p>
   </div>



     <h2>
       <a name="s3"></a>
       1.3. Getting Net::SSH
     </h2>

   

   <div class="section">
     <h3>Prerequisites:</h3>


	<p>In order to use Net::SSH, you must be using a supported version of Ruby&#8217;s OpenSSL module. The version distributed with Ruby 1.8.1 and earlier is not sufficient, and is lacking several features that Net::SSH relies on. If you are using Ruby 1.8.1 (or earlier), you should either upgrade to 1.8.2, or download and install an updated version of the OpenSSL module. You can download a usable snapshot from the <a href="http://rubyforge.org/projects/net-ssh">Net::SSH downloads page</a>.</p>


	<p>Furthermore, you must make sure that Ruby&#8217;s OpenSSL module has been compiled against <em>at least</em> version 0.9.7 of the OpenSSL library. Prior versions lacked functionality that Net::SSH depends on (notably, the &#8216;padding&#8217; property of ciphers).</p>


	<p>Optionally, you can install the <a href="http://raa.ruby-lang.org/project/ruby-termios">ruby-termios</a>. If you do, then your passwords won&#8217;t be echoed to the screen when prompting you for the passphrases needed to load your keys (if your keys have passphrases).</p>


	<h3>Using <a href="http://rubygems.rubyforge.org">RubyGems</a></h3>


	<p>If you have <a href="http://rubygems.rubyforge.org">RubyGems</a> installed, installing Net::SSH is simple:</p>


	<div class='figure'>
<span class='caption'>Using Rubygems to install Net::SSH [shell]</span>
<div class='body'><link rel='stylesheet' type='text/css' href='stylesheets/shell.css' /><div class='shell'><pre>gem install net-ssh</pre></div></div></div>


	<p>You still need to make sure you have a working version of Ruby&#8217;s OpenSSL module, but other than that, you should be good to go!</p>


	<h3>Using <a href="http://rpa-base.rubyforge.org">rpa-base</a></h3>


	<p>If you have <a href="http://rpa-base.rubyforge.org">rpa-base</a> installed:</p>


	<div class='figure'>
<span class='caption'>Using RPA to install Net::SSH [shell]</span>
<div class='body'><link rel='stylesheet' type='text/css' href='stylesheets/shell.css' /><div class='shell'><pre>rpa install net-ssh</pre></div></div></div>


	<p>As with the gem install, you still need to make sure you have a working version of Ruby&#8217;s OpenSSL module, but other than that, you should be good to go!</p>


	<h3>Doing it the hard way</h3>


	<p>If you don&#8217;t have <a href="http://rubygems.rubyforge.org">RubyGems</a> or <a href="http://rpa-base.rubyforge.org">rpa-base</a>, or if you just prefer to install things by hand, you can always go to the <a href="http://rubyforge.org/projects/net-ssh">Net::SSH downloads page</a> and grab the package of your choice: <code>tar.gz</code>, <code>tar.bz2</code>, or <code>zip</code>.</p>


	<p>Then, unpack the archive and run the <code>setup.rb</code> script:</p>


	<div class='figure'>
<span class='caption'>Using setup.rb to install Net::SSH [shell]</span>
<div class='body'><link rel='stylesheet' type='text/css' href='stylesheets/shell.css' /><div class='shell'><pre>ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install</pre></div></div></div>
   </div>



     <h2>
       <a name="s4"></a>
       1.4. License Information
     </h2>

   

   <div class="section">
     <p>Net::SSH is made available under either the <span class="caps">BSD</span> license, or the same license Ruby (which, by extension, also allows the <span class="caps">GPL</span> as a permissable license as well). You can view the full text of any of these licenses in the <code>doc</code> subdirectory of the Net::SSH distrubtion. The texts of the <span class="caps">BSD</span> and <span class="caps">GPL</span> licenses are also available online: <a href="http://www.opensource.org/licenses/bsd-license.php"><span class="caps">BSD</span></a> and <a href="http://www.opensource.org/licenses/gpl-license.php"><span class="caps">GPL</span></a>.</p>


	<p>This manual (in any form, be it source or otherwise) and the scripts and templates used to generate it, are all distributed under the <a href="http://creativecommons.org">Creative Commons</a> <a href="http://creativecommons.org/licenses/by-sa/2.0">Attribution-ShareAlike</a> license.</p>


	<p>If you desire permission to use either Net::SSH or the manual in a manner incompatible with these licenses, please contact the copyright holder (<a href="mailto:jamis@37signals.com">Jamis Buck</a>) in order to negotiate a more compatible license.</p>
   </div>



     <h2>
       <a name="s5"></a>
       1.5. Support
     </h2>

   

   <div class="section">
     <p>Mailing lists, bug trackers, feature requests, and public forums are all available (courtesty of <a href="http://rubyforge.org">RubyForge</a>) at the <a href="http://rubyforge.org/projects/net-ssh">Net::SSH project page</a>.</p>


	<h3>Mailing Lists</h3>


	<table>
		<tr>
			<th><strong>List Name</strong> </th>
			<th>&#8212;</th>
			<th><strong>Description</strong> </th>
		</tr>
		<tr>
			<td style="vertical-align:top;text-align:center;"><a href="http://rubyforge.org/pipermail/net-ssh-users">net-ssh-users</a></td>
			<td style="vertical-align:top;text-align:center;"><a href="http://rubyforge.org/mailman/listinfo/net-ssh-users">subscribe / unsubscribe</a></td>
			<td> The Net::SSH users list is devoted to the discussion of and questions about the usage of the Net::SSH module. If you can&#8217;t quite figure out how to get a feature of Net::SSH to work, this is the list you would go to in order to ask your questions.</td>
		</tr>
		<tr>
			<td style="vertical-align:top;text-align:center;"><a href="http://rubyforge.org/pipermail/net-ssh-devel">net-ssh-devel</a></td>
			<td style="vertical-align:top;text-align:center;"><a href="http://rubyforge.org/mailman/listinfo/net-ssh-devel">subscribe / unsubscribe</a></td>
			<td> The Net::SSH developers list is devoted to the discussion of Net::SSH&#8217;s implementation. If you have created a patch that you would like to discuss, or if you would like to discuss a new feature, this is the list for you.</td>
		</tr>
	</table>
   </div>



     <h2>
       <a name="s6"></a>
       1.6. About the Author
     </h2>

   

   <div class="section">
     <p>Net::SSH was written by <a href="mailto:jamis@37signals.com">Jamis Buck</a>. Feel free to send him compliments, candy, money, praise, or new feature patches&#8212;he likes all those things. You can send him questions and suggestions, too, if you really want to. However, for bug reports and general feature requests, please use the trackers on the <a href="http://rubyforge.org/projects/net-ssh">Net::SSH project page</a>.</p>
   </div>



<div class="bottom"><div class="prevnext">
  
  <a href="index.html">Up</a>
  
    | <a href="chapter-2.html">Next (2. Starting a Session)</a>
  
</div></div>


        </div>

      </td></tr>
    </table>
  </body>
</html>