Go to main content

Managing Remote Systems in Oracle® Solaris 11.4

Exit Print View

Updated: November 2020

How to Copy Files to a Remote System (sftp)

  1. Change to the source directory on the local system.

    The directory from which you type the sftp command is the local working directory and thus the source directory for this operation.

  2. Establish an sftp connection.

    See How to Open and Close an sftp Connection to a Remote System.

  3. You can change to the target directory.
    sftp> cd target-directory
  4. Ensure that you have write permission in the target directory.
    sftp> ls -l target-directory
  5. To copy a single file, use the put command.

    Metacharacters may be used with the get command.

    sftp> put filename
  6. Close the sftp connection.
    sftp> bye
Example 6  Copying a File to a Remote System (sftp)

In this example, the user opens an sftp connection to the system host1, and uses the put command to copy a file from their system to the /tmp directory on system host1.

$ cd /tmp
$ sftp host1
Password: xxx
sftp> cd /tmp
sftp> put filef
uploading filef to /tmp/filef
filef                                     100%  325     0.3KB/s   00:00
sftp> ls
sftp> bye