Go to main content

Managing Secure Shell Access in Oracle® Solaris 11.3

Exit Print View

Updated: October 2019
 
 

How to Copy Files With Secure Shell

The following procedure shows how to use the scp command to copy encrypted files between hosts. You can copy encrypted files either between a local host and a remote host, or between two remote hosts. The scp command prompts for authentication. For more information, see Remote Copying With the scp Command in Managing Remote Systems in Oracle Solaris 11.3 and the scp(1) man page.

You can also use the sftp secure file transfer program. For more information, see the sftp (1) man page. For an example, see Example 7, Specifying a Port When Using the sftp Command and Logging In to a Remote System to Copy a File (sftp) in Managing Remote Systems in Oracle Solaris 11.3.


Note -  The audit service can audit SunSSH sftp transactions by using the ft audit class. For scp transactions, the audit service can audit access and exit for the ssh session. For more information, see How to Audit FTP and SFTP File Transfers in Managing Auditing in Oracle Solaris 11.3.
  1. Start the secure copy program.

    Specify the source file, the user name at the remote destination, and the destination directory.

    mySystem$ scp myfile.1 username@myRemoteSys:~
  2. Supply your passphrase when prompted.
    Enter passphrase for key '/home/username/.ssh/id_rsa': passphrase
    myfile.1       25% |*******                      |    640 KB  0:20 ETA
    myfile.1 

      After you type the passphrase, a progress meter is displayed, as shown in the second line in the output. The progress meter displays:

    • The file name

    • The percentage of the file that has been transferred

    • A series of asterisks that indicate the percentage of the file that has been transferred

    • The quantity of data transferred

    • The estimated time of arrival, or ETA, of the complete file (that is, the remaining amount of time)

Example 7  Specifying a Port When Using the sftp Command

In this example, the user wants the sftp command to use a specific port. The user uses the –o option to specify the port.

$ sftp -o port=2222 guest@RemoteFileServer