Skip Navigation Links | |
Exit Print View | |
Managing Remote Systems in Oracle Solaris 11.1 Oracle Solaris 11.1 Information Library |
1. Working With Remote Systems (Overview)
2. Administering the FTP Server (Tasks)
3. Accessing Remote Systems (Tasks)
Accessing Remote Systems (Task Map)
Logging In to a Remote System (ssh)
Authentication for Remote Logins (ssh)
The /etc/ssh_known_hosts and .ssh/known_hosts Files
What Happens After You Log In Using Secure Shell
How to Log In to a Remote System (ssh)
Logging Out of a Remote System (exit or logout)
Logging In to a Remote System to Copy a File (sftp)
How to Open and Close an sftp Connection to a Remote System
Remote Copying With the scp Command
Security Considerations for Copy Operations
Specifying the Source and Target for Copy Operations
The sftp command is an interactive file transfer program with a user interface similar to ftp. However, sftp uses the SSH File Transfer Protocol to create a secure connection to the server. Not all options available with the ftp command are included in the sftp command, but many of them are.
The following table lists essential sftp commands.
Table 3-2 Essential sftp Commands
|
For more information, see the sftp(1) man page.
$ sftp remote-system
If the connection succeeds, a confirmation message and prompt are displayed.
Password: password
If the sftp interface accepts your password, it displays a confirmation message and the (sftp>) prompt.
You can now use any of the commands that are supplied by the sftp interface, including help. The principal commands are summarized in Table 3-2.
sftp> bye
Example 3-2 Opening an sftp Connection to a Remote System
This sftp session was established to connect to the remote system pluto:
$ sftp pluto Connecting to pluto. Password: password sftp>
See How to Open and Close an sftp Connection to a Remote System.
sftp> lcd target-directory
sftp> cd source-directory
sftp> ls -l
Metacharacters may be used with the get command.
sftp> get filename
sftp> bye
Example 3-3 Copying a File From a Remote System (sftp)
In this example, the user opens an sftp connection to the system pluto, and uses the get command to copy a single file from the /tmp directory.
$ sftp pluto Connecting to pluto... Password: xxx sftp> lcd /tmp sftp> cd /tmp sftp> ls filea files ps_data sftp> get filea /tmp/filea 100% 494 0.5KB/s 00:00 sftp> bye
The directory from which you type the sftp command is the local working directory and thus the source directory for this operation.
See How to Open and Close an sftp Connection to a Remote System.
sftp> cd target-directory
sftp> ls -l target-directory
Metacharacters may be used with the get command.
sftp> put filename
sftp> bye
Example 3-4 Copying a File to a Remote System (sftp)
In this example, the user opens an sftp connection to the system pluto, and uses the put command to copy a file from their system to the /tmp directory on system pluto.
$ cd /tmp $ sftp pluto Password: xxx sftp> cd /tmp sftp> put filef uploading filef to /tmp/filef filef 100% 325 0.3KB/s 00:00 sftp> ls filea filef files sftp> bye