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 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 99.2beta8 (1.46)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>12. Using Internet Services</TITLE>
<META NAME="description" CONTENT="12. Using Internet Services">
<META NAME="keywords" CONTENT="rute">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v99.2beta8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="rute.css">
<LINK REL="next" HREF="node16.html">
<LINK REL="previous" HREF="node14.html">
<LINK REL="up" HREF="rute.html">
<LINK REL="next" HREF="node16.html">
</HEAD>
<BODY BGCOLOR=#FFFFFF >
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<TR><TD align=left bgcolor="#000000">
<FONT COLOR=white>
<A HREF="http://www.icon.co.za/~psheer/rute-purchase.html"><FONT COLOR=white>Purchase</FONT></A>
</FONT>
</TD><TD align=center bgcolor="#000000">
<FONT COLOR=white>
Copyright © 2002 Paul Sheer. <A HREF="copying.html"><FONT COLOR=white>Click here for copying permissions.</FONT></A>
</FONT>
</TD><TD align=right bgcolor="#000000">
<FONT COLOR=white>
<A HREF="http://www.icon.co.za/~psheer/rute-home.html"><FONT COLOR=white>Home</FONT></A>
</FONT>
</TD></TR>
<TR><TD colspan=2 align=left bgcolor="#ECEBF4">
<IMG SRC="va-btn-small-light-60.png">
</TD><TD align=right bgcolor="#ECEBF4">
<IMG SRC="sflogo2-steel-60.png">
</TD></TR>
</TABLE><BR>
<!--Navigation Panel-->
<A NAME="tex2html1954"
HREF="node16.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html1950"
HREF="rute.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html1944"
HREF="node14.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html1952"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1955"
HREF="node16.html">13. LINUX Resources</A>
<B> Up:</B> <A NAME="tex2html1951"
HREF="rute.html">rute</A>
<B> Previous:</B> <A NAME="tex2html1945"
HREF="node14.html">11. User Accounts and</A>
  <B> <A NAME="tex2html1953"
HREF="node1.html">Contents</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
<UL>
<LI><A NAME="tex2html1956"
HREF="#SECTION001510000000000000000">12.1 <TT>
<FONT COLOR="#0000ff">ssh</FONT></TT>, not <TT>
<FONT COLOR="#0000ff">telnet</FONT></TT> or <TT>
<FONT COLOR="#0000ff">rlogin</FONT></TT></A>
<LI><A NAME="tex2html1957"
HREF="#SECTION001520000000000000000">12.2 <TT>
<FONT COLOR="#0000ff">rcp</FONT></TT> and <TT>
<FONT COLOR="#0000ff">scp</FONT></TT></A>
<LI><A NAME="tex2html1958"
HREF="#SECTION001530000000000000000">12.3 <TT>
<FONT COLOR="#0000ff">rsh</FONT></TT></A>
<LI><A NAME="tex2html1959"
HREF="#SECTION001540000000000000000">12.4 FTP</A>
<LI><A NAME="tex2html1960"
HREF="#SECTION001550000000000000000">12.5 <TT>
<FONT COLOR="#0000ff">finger</FONT></TT></A>
<LI><A NAME="tex2html1961"
HREF="#SECTION001560000000000000000">12.6 Sending Files by Email</A>
<UL>
<LI><A NAME="tex2html1962"
HREF="#SECTION001561000000000000000">12.6.1 <TT>
<FONT COLOR="#0000ff">uuencode</FONT></TT> and <TT>
<FONT COLOR="#0000ff">uudecode</FONT></TT></A>
<LI><A NAME="tex2html1963"
HREF="#SECTION001562000000000000000">12.6.2 MIME encapsulation</A>
</UL></UL>
<!--End of Table of Child-Links-->
<HR>
<H1><A NAME="SECTION001500000000000000000">
12. Using Internet Services</A>
</H1>
<P>
<A NAME="chap:netservices"></A>
<P>
This chapter summarizes remote access and the various
methods of transferring files and data over the Internet.
<P>
<H1><A NAME="SECTION001510000000000000000">
12.1 <TT>
<FONT COLOR="#0000ff">ssh</FONT></TT>, not <TT>
<FONT COLOR="#0000ff">telnet</FONT></TT> or <TT>
<FONT COLOR="#0000ff">rlogin</FONT></TT></A>
</H1>
<P>
<TT>
<FONT COLOR="#0000ff">telnet</FONT></TT> is a program for talking to a U<SMALL>NIX</SMALL> network service. It is
most often used to do a remote login. Try
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>telnet <remote_machine></code><br>
<code>telnet localhost</code><br>
</FONT></TD></TR></TABLE><P>
to log in to your remote machine. It needn't matter if there is
no physical network; network services always work regardless
because the machine always has an internal link to itself.
<P>
<TT>
<FONT COLOR="#0000ff">rlogin</FONT></TT> is like a minimal version of <TT>
<FONT COLOR="#0000ff">telnet</FONT></TT>
that allows login access only. You can type
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>rlogin -l <username> <remote_machine></code><br>
<code>rlogin -l jack localhost</code><br>
</FONT></TD></TR></TABLE><P>
if the system is configured to support remote logins.
<P>
These two services are the domain of old world U<SMALL>NIX</SMALL>;
for security reasons, <TT>
<FONT COLOR="#0000ff">ssh</FONT></TT> is now the preferable service for
logging in remotely:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>ssh [-l <username>] <remote_machine></code><br>
</FONT></TD></TR></TABLE><P>
<P>
<I>Though <TT>
<FONT COLOR="#0000ff">rlogin</FONT></TT> and <TT>
<FONT COLOR="#0000ff">telnet</FONT></TT> are very convenient,
they should <I>never</I> be used across a public network because
your password can easily be read off the wire as you type it in.</I>
<P>
<H1><A NAME="SECTION001520000000000000000">
12.2 <TT>
<FONT COLOR="#0000ff">rcp</FONT></TT> and <TT>
<FONT COLOR="#0000ff">scp</FONT></TT></A>
</H1>
<P>
<TT>
<FONT COLOR="#0000ff">rcp</FONT></TT> stands for <I>remote copy</I> and <TT>
<FONT COLOR="#0000ff">scp</FONT></TT> is
the secure version from the <TT>
<FONT COLOR="#0000ff">ssh</FONT></TT> package.
These two commands copy files from one machine to another using a similar
notation to <TT>
<FONT COLOR="#0000ff">cp</FONT></TT>.
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>rcp [-r] [<remote_machine>:]<file> [<remote_machine>:]<file></code><br>
<code>scp [-l <username>] [-r] [<remote_machine>:]<file> [<remote_machine>:]<file></code><br>
</FONT></TD></TR></TABLE><P>
Here is an example:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red size="-1">
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-2"><code>5</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-2"><code>10</code></font><code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue size="-1">
<code>[psheer@cericon]# <font color="navy"><B>rcp /var/spool/mail/psheer \</B></font></code><br>
<code><font color="navy"><B> divinian.cranzgot.co.za:/home/psheer/mail/cericon</B></font></code><br>
<code>[psheer@cericon]# <font color="navy"><B>scp /var/spool/mail/psheer \</B></font></code><br>
<code><font color="navy"><B> divinian.cranzgot.co.za:/home/psheer/mail/cericon</B></font></code><br>
<code>The authenticity of host 'divinian.cranzgot.co.za' can't be established.</code><br>
<code>RSA key fingerprint is 43:14:36:5d:bf:4f:f3:ac:19:08:5d:4b:70:4a:7e:6a.</code><br>
<code>Are you sure you want to continue connecting (yes/no)? <font color="navy"><B>yes</B></font></code><br>
<code>Warning: Permanently added 'divinian.cranzgot.co.za' (RSA) to the list of known hosts.</code><br>
<code>psheer@divinian's password: </code><br>
<code>psheer 100% |***************************************| 4266 KB 01:18</code><br>
</FONT></TD></TR></TABLE><P>
<P>
The <TT>
<FONT COLOR="#0000ff">-r</FONT></TT> option copies recursively and
copies can take place in either direction or even between two
nonlocal machines.
<P>
<I><TT>
<FONT COLOR="#0000ff">scp</FONT></TT> should always be used instead of <TT>
<FONT COLOR="#0000ff">rcp</FONT></TT>
for security reasons.</I> Notice also
the warning given by <TT>
<FONT COLOR="#0000ff">scp</FONT></TT> for this first-time
connection. See the <TT>
<FONT COLOR="#0000ff">ssh</FONT></TT> documentation for how
to make your first connection securely. All commands
in the <TT>
<FONT COLOR="#0000ff">ssh</FONT></TT> package have this same behavior.
<P>
<H1><A NAME="SECTION001530000000000000000">
12.3 <TT>
<FONT COLOR="#0000ff">rsh</FONT></TT></A>
</H1>
<P>
<TT>
<FONT COLOR="#0000ff">rsh</FONT></TT> (<I>remote shell</I>) is a useful utility for
executing a command on a
remote machine. Here are some
examples:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>[psheer@cericon]# <font color="navy"><B>rsh divinian.cranzgot.co.za hostname</B></font></code><br>
<code>divinian.cranzgot.co.za</code><br>
<code>[psheer@cericon]# <font color="navy"><B>rsh divinian.cranzgot.co.za \</B></font></code><br>
<code><font color="navy"><B> tar -czf - /home/psheer | dd of=/dev/fd0 bs=1024</B></font></code><br>
<code>tar: Removing leading `/' from member names</code><br>
<code>20+0 records in</code><br>
<code>20+0 records out</code><br>
<code>[psheer@cericon]# <font color="navy"><B>cat /var/spool/mail/psheer | rsh divinian.cranzgot.co.za \</B></font></code><br>
<code><font color="navy"><B> sh -c 'cat >> /home/psheer/mail/cericon'</B></font></code><br>
</FONT></TD></TR></TABLE><P>
The first command prints the host name of the remote machine.
The second command backs up my <I>remote</I> home directory to my <I>local</I>
floppy disk. (More about <TT>
<FONT COLOR="#0000ff">dd</FONT></TT>
and <TT>
<FONT COLOR="#0000ff">/dev/fd0</FONT></TT> come later.)
The last command appends my local mailbox file to a remote mailbox file.
Notice how stdin, stdout, and stderr
are properly redirected to the local
terminal. After reading Chapter <A HREF="node32.html#chap:xinetd">29</A> see <TT>
<FONT COLOR="#0000ff">rsh</FONT></TT>(8) or
<TT>
<FONT COLOR="#0000ff">in.rshd</FONT></TT>(8) to configure this service.
<P>
<I>Once again, for security reasons <TT>
<FONT COLOR="#0000ff">rsh</FONT></TT> should
never be available across a public network.</I>
<P>
<H1><A NAME="SECTION001540000000000000000">
12.4 FTP</A>
</H1>
<P>
FTP stands for <I>File Transfer Protocol</I>. If FTP is set up
on your local machine, then other machines can download files.
Type
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>ftp metalab.unc.edu</code><br>
</FONT></TD></TR></TABLE><P>
or
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>ncftp metalab.unc.edu</code><br>
</FONT></TD></TR></TABLE><P>
<P>
<TT>
<FONT COLOR="#0000ff">ftp</FONT></TT> is the traditional command-line U<SMALL>NIX</SMALL> FTP
<I>client</I>, <FONT COLOR="#ffa500">[``<I>client</I>'' always indicates
the user program accessing some remote service.]</FONT>while <I>ncftp</I> is a more powerful client that will not
always be installed.
<P>
You will now be inside an FTP <I>session</I>. You will be asked
for a login name and a password. The site
<TT>
<FONT COLOR="#0000ff">metalab.unc.edu</FONT></TT> is one that allows <I>anonymous</I>
logins. This means that you can type <TT>
<FONT COLOR="#0000ff">anonymous</FONT></TT> as your
user name, and then anything you like as a password. You will
notice that the session will ask you for an email address as your
password. Any sequence of letters with an <TT>
<FONT COLOR="#0000ff">@</FONT></TT> symbol will
suffice, but you should put your actual email address out of
politeness.
<P>
The FTP session is like a reduced shell. You can type <TT>
<FONT COLOR="#0000ff">cd</FONT></TT>,
<TT>
<FONT COLOR="#0000ff">ls</FONT></TT>, and <TT>
<FONT COLOR="#0000ff">ls -al</FONT></TT> to view file lists. <TT>
<FONT COLOR="#0000ff">help</FONT></TT> brings up
a list of commands, and you can also type <TT>
<FONT COLOR="#0000ff">help <command></FONT></TT>
to get help on a specific command. You can download a file by using
the <TT>
<FONT COLOR="#0000ff">get <filename></FONT></TT> command, but before you do this, you
must set the <I>transfer type</I> to <I>binary</I>. The
<I>transfer type</I> indicates whether or not newline
characters will be translated to DOS format. Typing
<TT>
<FONT COLOR="#0000ff">ascii</FONT></TT> turns on this feature, while <TT>
<FONT COLOR="#0000ff">binary</FONT></TT> turns it off.
You may also want to enter <TT>
<FONT COLOR="#0000ff">hash</FONT></TT> which will print a
<TT>
<FONT COLOR="#0000ff">#</FONT></TT> for every 1024 bytes of download. This is useful for
watching the progress of a download. Go to a directory that has a <TT>
<FONT COLOR="#0000ff">README</FONT></TT>
file in it and enter
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>get README</code><br>
</FONT></TD></TR></TABLE><P>
The file will be downloaded into your current directory.
<P>
You can also <TT>
<FONT COLOR="#0000ff">cd</FONT></TT> to the <TT>
<FONT COLOR="#0000ff">/incoming</FONT></TT> directory and
upload files. Try
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>put README</code><br>
</FONT></TD></TR></TABLE><P>
to upload the file that you have just downloaded. Most FTP sites
have an <TT>
<FONT COLOR="#0000ff">/incoming</FONT></TT> directory that is flushed periodically.
<P>
FTP allows far more than just uploading of files, although the
administrator has the option to restrict access to any further
features. You can create directories, change ownerships, and do
almost anything you can on a local file system.
<P>
If you have several machines on a trusted <I>LAN</I>
(<I>Local Area Network</I>--that is,
your private office or home network), all should have FTP
enabled to allow users to easily copy files between machines.
How to install and configure one of the many available FTP
servers will become obvious later in this book.
<P>
<H1><A NAME="SECTION001550000000000000000">
12.5 <TT>
<FONT COLOR="#0000ff">finger</FONT></TT></A>
</H1>
<P>
<TT>
<FONT COLOR="#0000ff">finger</FONT></TT> is a service for remotely listing who is logged in on a remote system.
Try <TT>
<FONT COLOR="#0000ff">finger @<hostname></FONT></TT> to see who is logged in on
<TT>
<FONT COLOR="#0000ff"><hostname></FONT></TT>. The <I>finger</I> service will often be disabled on
machines for security reasons.
<P>
<H1><A NAME="SECTION001560000000000000000">
12.6 Sending Files by Email</A>
</H1>
<P>
<A NAME="sec:filesoveremail"></A>
<P>
Mail is being used more and more for transferring files
between machines. It is bad practice to send mail messages over
64 kilobytes over the Internet because it tends to excessively
load mail servers. Any file larger than 64 kilobytes should be
uploaded by FTP onto some common FTP server. Most small images
are smaller than this size, hence sending a small
JPEG <FONT COLOR="#ffa500">[A common Internet image file format. These are
especially compressed and are usually under 100 kilobytes for a
typical screen-sized photograph.]</FONT> image is considered
acceptable.
<P>
<H2><A NAME="SECTION001561000000000000000">
12.6.1 <TT>
<FONT COLOR="#0000ff">uuencode</FONT></TT> and <TT>
<FONT COLOR="#0000ff">uudecode</FONT></TT></A>
</H2>
<P>
If you must send files by mail then you can do it by using
<TT>
<FONT COLOR="#0000ff">uuencode</FONT></TT>. This utility packs binary files
into a format that mail servers can handle. If you send a mail
message containing arbitrary binary data, it will more than
likely be corrupted on the way because mail agents are only
designed to handle a limited range of characters.
<TT>
<FONT COLOR="#0000ff">uuencode</FONT></TT> represents a binary file with
allowable characters, albeit taking up slightly more space.
<P>
Here is a neat trick to pack up a directory and send it
to someone by mail.
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>tar -czf - <mydir> | uuencode <mydir>.tar.gz \</code><br>
<code> | mail -s "Here are some files" <user>@<machine></code><br>
</FONT></TD></TR></TABLE><P>
<P>
To unpack a <TT>
<FONT COLOR="#0000ff">uuencode</FONT></TT>d file, use the <TT>
<FONT COLOR="#0000ff">uudecode</FONT></TT>
command:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>uudecode <myfile>.uu</code><br>
</FONT></TD></TR></TABLE><P>
<P>
<H2><A NAME="SECTION001562000000000000000">
12.6.2 MIME encapsulation</A>
</H2>
<P>
<A NAME="sec:mimeencap"></A>
<P>
Most graphical mail readers have the ability to <I>attach</I> files to
mail messages and read these attachments. The way they do this
is not with <TT>
<FONT COLOR="#0000ff">uuencode</FONT></TT> but in a special format known as
<I>MIME encapsulation</I>. MIME (<I>Multipurpose Internet
Mail Extensions</I>) is a way of representing multiple
files inside a single mail message. The way binary data is
handled is similar to <TT>
<FONT COLOR="#0000ff">uuencode</FONT></TT>, but in a format known
as <I>base64</I>.
<P>
Each MIME attachment to a mail message has a particular type,
known as the <I>MIME type</I>. MIME types
merely classify the attached file as an image, an audio clip,
a formatted document, or some other type of data. The MIME type
is a text tag with the format
<TT>
<FONT COLOR="#0000ff"><major>/<minor></FONT></TT>.
The <TT>
<FONT COLOR="#0000ff">major</FONT></TT> part is called the <I>major MIME type</I> and the
<TT>
<FONT COLOR="#0000ff">minor</FONT></TT> part is called the <I>minor MIME type</I>. Available
major types match all the kinds of files that you would expect to
exist. They are usually one of <TT>
<FONT COLOR="#0000ff">application</FONT></TT>, <TT>
<FONT COLOR="#0000ff">audio</FONT></TT>,
<TT>
<FONT COLOR="#0000ff">image</FONT></TT>, <TT>
<FONT COLOR="#0000ff">message</FONT></TT>, <TT>
<FONT COLOR="#0000ff">text</FONT></TT>, or <TT>
<FONT COLOR="#0000ff">video</FONT></TT>.
The <TT>
<FONT COLOR="#0000ff">application</FONT></TT> type means a file format specific to
a particular utility. The minor MIME types run into the hundreds.
A long list of MIME types can be found in <TT>
<FONT COLOR="#0000ff">/etc/mime.types</FONT></TT>.
<P>
If needed, some useful command-line utilities in the
same vein as <TT>
<FONT COLOR="#0000ff">uuencode</FONT></TT> can create and extract MIME
messages. These are <TT>
<FONT COLOR="#0000ff">mpack</FONT></TT>,
<TT>
<FONT COLOR="#0000ff">munpack</FONT></TT>, and <TT>
<FONT COLOR="#0000ff">mmencode</FONT></TT>
(or <TT>
<FONT COLOR="#0000ff">mimencode</FONT></TT>).
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1954"
HREF="node16.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html1950"
HREF="rute.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html1944"
HREF="node14.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html1952"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1955"
HREF="node16.html">13. LINUX Resources</A>
<B> Up:</B> <A NAME="tex2html1951"
HREF="rute.html">rute</A>
<B> Previous:</B> <A NAME="tex2html1945"
HREF="node14.html">11. User Accounts and</A>
  <B> <A NAME="tex2html1953"
HREF="node1.html">Contents</A></B>
<!--End of Navigation Panel-->
</BODY>
</HTML>
|