📄 590-592.html
字号:
<HTML>
<HEAD>
<TITLE>Special Edition Using Linux, Fourth Edition:Accessing the Network with telnet, ftp, and the r-Commands</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0789717468//-->
<!--TITLE=Special Edition Using Linux, Fourth Edition//-->
<!--AUTHOR=Jack Tackett//-->
<!--AUTHOR=Jr.//-->
<!--AUTHOR=Steve Burnett//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Que//-->
<!--CHAPTER=30//-->
<!--PAGES=590-592//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="588-590.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="592-594.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading12"></A><FONT COLOR="#000077"><I>rsh</I>
</FONT></H4>
<P>The <TT>rsh</TT> command, an abbreviation for <I>remote shell</I>, starts a shell on the specified remote host and executes the command, if any, that you specify on the <TT>rsh</TT> command line. If you don’t give a command to execute, you’re logged in to the remote machine by using <TT>rlogin</TT>.</P>
<P>The syntax of the <TT>rsh</TT> command is as follows:</P>
<!-- CODE SNIP //-->
<PRE>
rsh [-Kdnx] [-k <I>realm</I>] [-l <I>user-name</I>] <I>hostname</I> [ <I>command</I>]
</PRE>
<!-- END CODE SNIP //-->
<P>However, the most common usage is this:
</P>
<!-- CODE SNIP //-->
<PRE>
rsh <I>hostname</I> [<I>command</I>]
</PRE>
<!-- END CODE SNIP //-->
<P>The <TT>command</TT> argument can be virtually any Linux command that can be entered from the shell prompt. Table 30.4 explains the command-line options for <TT>rsh</TT>.</P>
<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 30.4</B> Command-Line Options for the <TT>rsh</TT> Command
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TH WIDTH="20%" ALIGN="LEFT">Option
<TH WIDTH="80%" ALIGN="LEFT">Description
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TD VALIGN="TOP"><TT>-K</TT>
<TD>Turns off all Kerberos authentication. It’s used only when connecting to a host that uses Kerberos.
<TR>
<TD VALIGN="TOP"><TT>-d</TT>
<TD>Turns on socket debugging on the TCP sockets used for communication with the remote host. See the <TT>setsockopt</TT> man page for more information.
<TR>
<TD VALIGN="TOP"><TT>-k</TT>
<TD>Requests <TT>rsh</TT> to obtain Kerberos tickets for the remote host in the specified realm instead of the remote host’s realm as determined by <TT>krb_realmofhost(3)</TT>.
<TR>
<TD VALIGN="TOP"><TT>-l</TT>
<TD>Allows the remote name to be specified. If available, Kerberos authentication is used, and authorization is determined as with the <TT>rlogin</TT> command.
<TR>
<TD VALIGN="TOP"><TT>-n</TT>
<TD>Redirects input from the special device /dev/null.
<TR>
<TD VALIGN="TOP"><TT>-x</TT>
<TD>Turns on DES encryption for all data passed. This can affect response time and CPU usage, but it provides increased security.
<TR>
<TD COLSPAN="2"><HR>
</TABLE>
<P>Linux takes the standard input to the <TT>rsh</TT> command and copies it to the standard input of the remotely executed command. It copies the standard output of the remote command to standard output for <TT>rsh</TT>. It also copies the remote standard error to the local standard error file descriptor. Any quit, terminate, and interrupt signals are sent to the remote command. Also, any special shell characters that aren’t enclosed with quotation marks, as in “>>”, are handled locally. If enclosed with quotation marks, these characters are handled by the remote command.</P>
<H4 ALIGN="LEFT"><A NAME="Heading13"></A><FONT COLOR="#000077"><I>rcp</I>
</FONT></H4>
<P>The <TT>rcp</TT> command, which stands for <I>remote copy</I>, is the last of the <TT>r-</TT> commands that you need to know. It’s used to copy files between computers. You can use <TT>rcp</TT> to copy files from one remote computer to another, without either the source or destination being on the local machine.</P>
<P>The <TT>rcp</TT> command has two forms. The first form is used to copy a file to a file. The second form is used when copying files or a directory to a directory. The syntax for the <TT>rcp</TT> command can be either of the following:</P>
<!-- CODE SNIP //-->
<PRE>
rcp [-px] [-k <I>realm</I>] <I>filename1 filename2</I>
rcp [-px] [-r] [-k <I>realm</I>] <I>file(s) directory</I>
</PRE>
<!-- END CODE SNIP //-->
<P>Each file or directory argument is either a remote filename or a local filename. Remote filenames have the form rname<TT>@rhost:path</TT>, where <I>rname</I> is the remote username, <I>rhost</I> is the remote computer, and <I>path</I> is the path to the file. The filename must contain a colon.</P>
<P>Table 30.5 explains the arguments for <TT>rcp</TT>.</P>
<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 30.5</B> Command-Line Arguments for the <TT>rcp</TT> Command
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TH WIDTH="15%" ALIGN="LEFT">Option
<TH WIDTH="85%" ALIGN="LEFT">Description
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TD VALIGN="TOP"><TT>-r</TT>
<TD>Recursively copies the source directory tree into the destination directory. To use this option, the destination must be a directory.
<TR>
<TD VALIGN="TOP"><TT>-p</TT>
<TD>Tries to preserve the modification times and modes of the source files, ignoring the <TT>umask</TT>.
<TR>
<TD VALIGN="TOP"><TT>-k</TT>
<TD>Requests <TT>rcp</TT> to obtain Kerberos tickets for the remote host in the specified realm instead of the remote host’s realm, as determined by <TT>krb_realmofhost(3)</TT>.
<TR>
<TD VALIGN="TOP"><TT>-x</TT>
<TD>Turns on DES encryption for all data passed by <TT>rcp</TT>. This can affect response time and CPU usage but provides increased security.
<TR>
<TD COLSPAN="2"><HR>
</TABLE>
<P>If the path specified in the filename isn’t a full path name, it’s interpreted as being relative to the login directory of the specified user on the remote computer. If no remote username is given, your current username is used. If a path on a remote host contains special shell characters, it can be quoted by using \, “, or ‘ as appropriate. This causes all the shell metacharacters to be interpreted remotely.
</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE: </B><TT>rcp</TT> doesn’t prompt for passwords. It performs its copies via the <TT>rsh</TT> command.<HR></FONT>
</BLOCKQUOTE>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="588-590.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="592-594.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -