old-www/LDP/solrhe/Securing-Optimizing-Linux-R.../chap15sec125.html

409 lines
6.6 KiB
HTML

<HTML
><HEAD
><TITLE
>OpenSSH Users Tools</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.60"><LINK
REL="HOME"
TITLE="Securing and Optimizing Linux"
HREF="index.html"><LINK
REL="UP"
TITLE="Software -Securities"
HREF="soft-netsecured.html"><LINK
REL="PREVIOUS"
TITLE="OpenSSH Per-User Configuration"
HREF="chap15sec124.html"><LINK
REL="NEXT"
TITLE="Installed files"
HREF="chap15sec126.html"></HEAD
><BODY
CLASS="section"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Securing and Optimizing Linux: RedHat Edition -A Hands on Guide</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="chap15sec124.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 15. Software -Securities</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="chap15sec126.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="AEN8480"
>15.7. OpenSSH Users Tools</A
></H1
><P
>&#13; The commands listed belows are some that we use often in our regular use, but many more exist, and you should check the man page and documentation for more details. The <TT
CLASS="literal"
>ssh</TT
> Secure Shell command
provides secure encrypted communications between two untrusted hosts over an insecure network. It is a program for logging securely into a remote machine and executing commands from there. It is a suitable replacement
for insecure programs like telnet, rlogin, rcp, rdist, and rsh.
</P
><P
>&#13; To login to a remote machine, use the command:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13; [root@deep] /#<B
CLASS="command"
>ssh</B
> -l &#60;login_name&#62; &#60;hostname&#62;
</PRE
></TD
></TR
></TABLE
>
</P
><DIV
CLASS="example"
><A
NAME="AEN8487"
></A
><P
><B
>Example 15-1. Remote login using ssh</B
></P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13; [root@deep] /#<B
CLASS="command"
>ssh</B
> -l admin www.openna.com
</PRE
></TD
></TR
></TABLE
>
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="literallayout"
><TT
CLASS="computeroutput"
>&#13; admin@deep.openna.coms password:
Last login: Tue Oct 19 1999 18:13:00 -0400 from deep.openna.com
No mail.
</TT
>
</PRE
></TD
></TR
></TABLE
>
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13; [admin@www ]/admin$
</PRE
></TD
></TR
></TABLE
>
Where &#60;login_name&#62; is the name you use to connect to the ssh server and &#60;hostname&#62; is the remote address of your ssh server.
</P
></DIV
><DIV
CLASS="section"
><H2
CLASS="section"
><A
NAME="AEN8495"
>15.7.1. scp</A
></H2
><P
>&#13; The scp Secure Copy utility copies files from the local system to a remote system or vice versa, or even between two remote systems using the scp command. To copy files from remote to local system, use
the following command:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13; [root@deep] /#<B
CLASS="command"
>su</B
> admin
[admin@deep /]$<B
CLASS="command"
>scp</B
> -p &#60;login_name@hostname&#62;:/dir/for/file localdir/to/filelocation
</PRE
></TD
></TR
></TABLE
>
</P
><DIV
CLASS="example"
><A
NAME="AEN8501"
></A
><P
><B
>Example 15-2. scp Secure Copy utility</B
></P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13; [admin@deep /]$ scp1 -p admin@mail:/etc/test1 /tmp
</PRE
></TD
></TR
></TABLE
>
<P
CLASS="literallayout"
><TT
CLASS="computeroutput"
>&#13; Enter passphrase for RSA key 'admin@mail.openna.com':
test1 | 2 KB | 2.0 kB/s | ETA: 00:00:00 | 100%
</TT
></P
>
</P
></DIV
><P
>&#13; To copy files from local to remote system, use the following command:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13; [root@deep] /#<B
CLASS="command"
>su</B
> admin
[admin@deep /]$<B
CLASS="command"
>scp</B
> -p localdir/to/filelocation &#60;username@hostname&#62;:/dir/for/file
</PRE
></TD
></TR
></TABLE
>
</P
><DIV
CLASS="example"
><A
NAME="AEN8511"
></A
><P
><B
>Example 15-3. local to remote</B
></P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13; [admin@deep /]$<B
CLASS="command"
>scp1</B
> -p /usr/bin/test2 admin@mail:/var/tmp
</PRE
></TD
></TR
></TABLE
>
<P
CLASS="literallayout"
><TT
CLASS="computeroutput"
>&#13; admin@mail's password:
test2 | 7 KB | 7.9 kB/s | ETA: 00:00:00 | 100%
</TT
></P
>
</P
></DIV
><DIV
CLASS="tip"
><BLOCKQUOTE
CLASS="tip"
><P
><B
><SPAN
CLASS="inlinemediaobject"
><IMG
SRC="./images/Tip.gif"
ALT="Tip"
></IMG
></SPAN
>: </B
>
The -p option indicates that the modification and access times, as well as modes of the source file, should be preserved on the copy. This is usually desirable.
</P
></BLOCKQUOTE
></DIV
><P
>&#13; Some possible uses of OpenSSH softwareare:
<P
></P
><OL
COMPACT="COMPACT"
TYPE="1"
><LI
><P
>&#13; Replace telnet, rlogin, rsh, rdist, and rcp.
</P
></LI
><LI
><P
>&#13; Make secure backups over the network.
</P
></LI
><LI
><P
>&#13; Execute remote commands.
</P
></LI
><LI
><P
>&#13; Access to corporate resources over the Internet.
</P
></LI
></OL
>
</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="chap15sec124.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="chap15sec126.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>OpenSSH Per-User Configuration</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="soft-netsecured.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Installed files</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>