Using The Sftp Command; Generating Key Pairs - Red Hat ENTERPRISE LINUX 4 System Administration Manual

Hide thumbs Also See for ENTERPRISE LINUX 4:
Table of Contents

Advertisement

The general syntax to transfer a local file to a remote system is as follows:
scp <localfile>username@tohostname:<remotefile>
The <localfile> specifies the source including path to the file, such as /var/log/maillog. The
<remotefile> specifies the destination, which can be a new filename such as /tmp/hostname-
maillog. For the remote system, if you do not have a preceding /, the path will be relative to the
home directory of username, typically /home/username/.
To transfer the local file shadowman to the home directory of your account on penguin.example.net,
type the following at a shell prompt (replace username with your username):
scp shadowman username@penguin.example.net:shadowman
This will transfer the local file shadowman to /home/username/shadowman on
penguin.example.net. Alternately, you can leave off the final shadowman in the scp command.
The general syntax to transfer a remote file to the local system is as follows:
scp username@tohostname:<remotefile><newlocalfile>
The <remotefile> specifies the source including path, and <newlocalfile> specifies the
destination including path.
Multiple files can be specified as the source files. For example, to transfer the contents of the directory
downloads/ to an existing directory called uploads/ on the remote machine penguin.example.net,
type the following at a shell prompt:
scp downloads/* username@penguin.example.net:uploads/

20.3.3. Using the sftp Command

The sftp utility can be used to open a secure, interactive FTP session. It is similar to ftp except that
it uses a secure, encrypted connection. The general syntax is sftp username@hostname.com.
Once authenticated, you can use a set of commands similar to those used by FTP. Refer to the sftp
man page for a list of these commands. To read the man page, execute the command man sftp at a
shell prompt. The sftp utility is only available in OpenSSH version 2.5.0p1 and higher.

20.3.4. Generating Key Pairs

If you do not want to enter your password every time you use ssh, scp, or sftp to connect to a
remote machine, you can generate an authorization key pair.
Keys must be generated for each user. To generate keys for a user, use the following steps as the
user who wants to connect to remote machines. If you complete the steps as root, only root will be
able to use the keys.
Starting with OpenSSH version 3.0, ~/.ssh/authorized_keys2, ~/.ssh/known_hosts2,
and /etc/ssh_known_hosts2 are obsolete. SSH Protocol 1 and 2 share the ~/.ssh/
authorized_keys, ~/.ssh/known_hosts, and /etc/ssh/ssh_known_hosts files.
Using the sftp Command
199

Advertisement

Table of Contents
loading

Table of Contents