536 lines
8.2 KiB
HTML
536 lines
8.2 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Remote Administration Related</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
|
REL="HOME"
|
|
TITLE="GNU/Linux Command-Line Tools Summary"
|
|
HREF="book1.htm"><LINK
|
|
REL="UP"
|
|
TITLE="Network Commands"
|
|
HREF="c8319.htm"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Internet Specific Commands"
|
|
HREF="x8751.htm"><LINK
|
|
REL="NEXT"
|
|
TITLE="Security"
|
|
HREF="c9295.htm"></HEAD
|
|
><BODY
|
|
CLASS="SECT1"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
SUMMARY="Header navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>GNU/Linux Command-Line Tools Summary</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="x8751.htm"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
>Chapter 13. Network Commands</TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="c9295.htm"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="SECT1"
|
|
><H1
|
|
CLASS="SECT1"
|
|
><A
|
|
NAME="REMOTE-ADMINISTRATION"
|
|
></A
|
|
>Remote Administration Related</H1
|
|
><P
|
|
></P
|
|
><DIV
|
|
CLASS="VARIABLELIST"
|
|
><DL
|
|
><DT
|
|
>ssh</DT
|
|
><DD
|
|
><P
|
|
><A
|
|
NAME="AEN9101"
|
|
></A
|
|
>Secure shell,<A
|
|
NAME="AEN9103"
|
|
></A
|
|
> remotely <A
|
|
NAME="AEN9105"
|
|
></A
|
|
>login <A
|
|
NAME="AEN9107"
|
|
></A
|
|
>on a machine running <A
|
|
NAME="AEN9109"
|
|
></A
|
|
>the <SPAN
|
|
CLASS="emphasis"
|
|
><I
|
|
CLASS="EMPHASIS"
|
|
>sshd</I
|
|
></SPAN
|
|
> daemon.<A
|
|
NAME="AEN9112"
|
|
></A
|
|
> Once you are logged <A
|
|
NAME="AEN9114"
|
|
></A
|
|
>in you have a secure shell and are able <A
|
|
NAME="AEN9116"
|
|
></A
|
|
>to execute<A
|
|
NAME="AEN9118"
|
|
></A
|
|
> various commands on that computer <A
|
|
NAME="AEN9120"
|
|
></A
|
|
>such as copy <A
|
|
NAME="AEN9122"
|
|
></A
|
|
>files, reboot the computer, just like it was your own GNU/Linux PC.<A
|
|
NAME="AEN9124"
|
|
></A
|
|
></P
|
|
><P
|
|
>Or you can use <SPAN
|
|
CLASS="emphasis"
|
|
><I
|
|
CLASS="EMPHASIS"
|
|
>ssh</I
|
|
></SPAN
|
|
> with a full hostname <A
|
|
NAME="AEN9128"
|
|
></A
|
|
>to connect <A
|
|
NAME="AEN9130"
|
|
></A
|
|
>to a remote <A
|
|
NAME="AEN9132"
|
|
></A
|
|
>machine (as in across the internet). </P
|
|
><P
|
|
>Examples:</P
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
>ssh hostname</PRE
|
|
><P
|
|
>Connect to a remote <A
|
|
NAME="AEN9137"
|
|
></A
|
|
>system with your current username, you will obviously need the password of the user on the other machine.</P
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
>ssh username@hostname </PRE
|
|
><P
|
|
>Connect to a remote <A
|
|
NAME="AEN9141"
|
|
></A
|
|
>system with your a different <A
|
|
NAME="AEN9143"
|
|
></A
|
|
>username, you will obviously need the password <A
|
|
NAME="AEN9145"
|
|
></A
|
|
>of the user on the other machine.</P
|
|
></DD
|
|
><DT
|
|
>scp</DT
|
|
><DD
|
|
><P
|
|
><A
|
|
NAME="AEN9151"
|
|
></A
|
|
>Secure copy,<A
|
|
NAME="AEN9153"
|
|
></A
|
|
> part <A
|
|
NAME="AEN9155"
|
|
></A
|
|
>of the ssh <A
|
|
NAME="AEN9157"
|
|
></A
|
|
>package.<A
|
|
NAME="AEN9159"
|
|
></A
|
|
> Allows you to copy files from one computer to another computer, use<SPAN
|
|
CLASS="emphasis"
|
|
><I
|
|
CLASS="EMPHASIS"
|
|
> -r<A
|
|
NAME="AEN9162"
|
|
></A
|
|
> </I
|
|
></SPAN
|
|
>to copy recursively (copy entire directories <A
|
|
NAME="AEN9164"
|
|
></A
|
|
>and subdirectories).</P
|
|
><P
|
|
><SPAN
|
|
CLASS="emphasis"
|
|
><I
|
|
CLASS="EMPHASIS"
|
|
>scp</I
|
|
></SPAN
|
|
>'s syntax <A
|
|
NAME="AEN9168"
|
|
></A
|
|
>is always</P
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
>scp machineToBeCopiedFrom machineToBeCopiedTo</PRE
|
|
><P
|
|
>Where either machine can be a local <A
|
|
NAME="AEN9172"
|
|
></A
|
|
>directory (on the current filesystem<A
|
|
NAME="AEN9174"
|
|
></A
|
|
> /) or a remote <A
|
|
NAME="AEN9176"
|
|
></A
|
|
>machine. Remote machines are usually <SPAN
|
|
CLASS="emphasis"
|
|
><I
|
|
CLASS="EMPHASIS"
|
|
>machinesFullName:/directory</I
|
|
></SPAN
|
|
> (if you omit <A
|
|
NAME="AEN9179"
|
|
></A
|
|
>the directory part it will just assume the home <A
|
|
NAME="AEN9181"
|
|
></A
|
|
>directory of the username you are logging <A
|
|
NAME="AEN9183"
|
|
></A
|
|
>in with).</P
|
|
><P
|
|
>The example below copies <A
|
|
NAME="AEN9186"
|
|
></A
|
|
>all files from the current directory (not including<A
|
|
NAME="AEN9188"
|
|
></A
|
|
> any directories), the command will login <A
|
|
NAME="AEN9190"
|
|
></A
|
|
>to “new” using the username of the person <A
|
|
NAME="AEN9192"
|
|
></A
|
|
>currently logged in on the local <A
|
|
NAME="AEN9194"
|
|
></A
|
|
>computer, the files will be copied to the root <A
|
|
NAME="AEN9196"
|
|
></A
|
|
>directory of the remote <A
|
|
NAME="AEN9198"
|
|
></A
|
|
>computer called “new” (which is probably <A
|
|
NAME="AEN9200"
|
|
></A
|
|
>on the LAN):</P
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
>scp * new:/</PRE
|
|
><P
|
|
>You could also copy files from another computer to another computer. Let's say you are on a computer called “p100”. And you want to copy files (and directories) from “hp166” (in the /tmp directory and anything below that) to “new” and put the files in new's temporary <A
|
|
NAME="AEN9204"
|
|
></A
|
|
>directory. You could do:</P
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
>scp -r hp166:/tmp new:/tmp</PRE
|
|
><P
|
|
>Assuming you were logged in as “fred” you would need passwords <A
|
|
NAME="AEN9208"
|
|
></A
|
|
>for user “fred” on the computers hp166 and new.<A
|
|
NAME="AEN9210"
|
|
></A
|
|
> Add <A
|
|
NAME="AEN9212"
|
|
></A
|
|
>an <SPAN
|
|
CLASS="emphasis"
|
|
><I
|
|
CLASS="EMPHASIS"
|
|
>user_name@</I
|
|
></SPAN
|
|
> before the computer name to login <A
|
|
NAME="AEN9215"
|
|
></A
|
|
>under a different user name. </P
|
|
><P
|
|
>For example to perform <A
|
|
NAME="AEN9218"
|
|
></A
|
|
>the above command with user “root” on hp166 <A
|
|
NAME="AEN9220"
|
|
></A
|
|
>and “anon” on new <A
|
|
NAME="AEN9222"
|
|
></A
|
|
>you would type:</P
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
>scp -r root@hp166:/tmp anon@new:/tmp</PRE
|
|
><P
|
|
>To copy from a remote <A
|
|
NAME="AEN9226"
|
|
></A
|
|
>machine to a local <A
|
|
NAME="AEN9228"
|
|
></A
|
|
>computer <A
|
|
NAME="AEN9230"
|
|
></A
|
|
>you simply do things in reverse:<A
|
|
NAME="AEN9232"
|
|
></A
|
|
></P
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
>scp remoteMachine:/mystuff/* .</PRE
|
|
><P
|
|
>This will copy files on the remote <A
|
|
NAME="AEN9236"
|
|
></A
|
|
>machine in the directory “mystuff” to your local <A
|
|
NAME="AEN9238"
|
|
></A
|
|
>computer.</P
|
|
><DIV
|
|
CLASS="NOTE"
|
|
><BLOCKQUOTE
|
|
CLASS="NOTE"
|
|
><P
|
|
><B
|
|
>Remote Machines: </B
|
|
>Please note that when working with a remote machine you need to have a : (colon) after the machine name even if you want the files in their home directory. Otherwise the command will fail.</P
|
|
></BLOCKQUOTE
|
|
></DIV
|
|
><P
|
|
></P
|
|
></DD
|
|
><DT
|
|
>sftp</DT
|
|
><DD
|
|
><P
|
|
><A
|
|
NAME="AEN9248"
|
|
></A
|
|
>Secure ftp,<A
|
|
NAME="AEN9250"
|
|
></A
|
|
> another part <A
|
|
NAME="AEN9252"
|
|
></A
|
|
>of the ssh <A
|
|
NAME="AEN9254"
|
|
></A
|
|
>package.<A
|
|
NAME="AEN9256"
|
|
></A
|
|
> This command is similar to ftp but uses an encrypted <A
|
|
NAME="AEN9258"
|
|
></A
|
|
>tunnel <A
|
|
NAME="AEN9260"
|
|
></A
|
|
>to connect to an ftp server <A
|
|
NAME="AEN9262"
|
|
></A
|
|
>and is therefore more <A
|
|
NAME="AEN9264"
|
|
></A
|
|
>secure <A
|
|
NAME="AEN9266"
|
|
></A
|
|
>than just plain <A
|
|
NAME="AEN9268"
|
|
></A
|
|
><SPAN
|
|
CLASS="emphasis"
|
|
><I
|
|
CLASS="EMPHASIS"
|
|
>ftp</I
|
|
></SPAN
|
|
>.</P
|
|
><P
|
|
>The command usage is very similar to <SPAN
|
|
CLASS="emphasis"
|
|
><I
|
|
CLASS="EMPHASIS"
|
|
>ftp</I
|
|
></SPAN
|
|
> (the command-line tool), <SPAN
|
|
CLASS="emphasis"
|
|
><I
|
|
CLASS="EMPHASIS"
|
|
>sftp</I
|
|
></SPAN
|
|
> (once running) uses commands such as<SPAN
|
|
CLASS="emphasis"
|
|
><I
|
|
CLASS="EMPHASIS"
|
|
> help <A
|
|
NAME="AEN9275"
|
|
></A
|
|
></I
|
|
></SPAN
|
|
>(for help), <SPAN
|
|
CLASS="emphasis"
|
|
><I
|
|
CLASS="EMPHASIS"
|
|
>put</I
|
|
></SPAN
|
|
> (send files to the server), <SPAN
|
|
CLASS="emphasis"
|
|
><I
|
|
CLASS="EMPHASIS"
|
|
>get</I
|
|
></SPAN
|
|
> (download files from the server) and various others, refer <A
|
|
NAME="AEN9279"
|
|
></A
|
|
>to the manual page and internal <A
|
|
NAME="AEN9281"
|
|
></A
|
|
>documentation <A
|
|
NAME="AEN9283"
|
|
></A
|
|
>for further details.</P
|
|
><DIV
|
|
CLASS="TIP"
|
|
><BLOCKQUOTE
|
|
CLASS="TIP"
|
|
><P
|
|
><B
|
|
>Graphical programs: </B
|
|
>Sometimes its easier to manage files with a GUI, many of these programs do have good <SPAN
|
|
CLASS="ACRONYM"
|
|
>GUI</SPAN
|
|
> equivalents, try searching the internet or sites like <A
|
|
HREF="http://sourceforge.net"
|
|
TARGET="_top"
|
|
>Sourceforge</A
|
|
><A
|
|
NAME="AEN9290"
|
|
></A
|
|
> or <A
|
|
HREF="http://freshmeat.net"
|
|
TARGET="_top"
|
|
>Freshmeat.</A
|
|
><A
|
|
NAME="AEN9293"
|
|
></A
|
|
></P
|
|
></BLOCKQUOTE
|
|
></DIV
|
|
></DD
|
|
></DL
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
SUMMARY="Footer navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="x8751.htm"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="book1.htm"
|
|
ACCESSKEY="H"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="c9295.htm"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Internet Specific Commands</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="c8319.htm"
|
|
ACCESSKEY="U"
|
|
>Up</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>Security</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |