skip book previous and next navigation links
go up to top of book: HP TCP/IP Services for OpenVMS Guide to SSH HP TCP/IP Services for OpenVMS Guide to SSH
go to beginning of chapter: SSH Command Reference SSH Command Reference
go to previous page: Before You Begin Before You Begin
go to next page: Remote Login and Command Execution with the SSH CommandRemote Login and Command Execution with the SSH Command
end of book navigation links

Copying Files 



You can use the following Secure Shell commands to copy files between clients and servers:

Using the SCP Command 

The SCP command securely copies files between a Secure Shell client and server. This command is intended as a secure replacement for the rcp command. When the user enters the SCP command, the client establishes an SSH session. If authentication succeeds and the user's identity has been accepted by the server, the server executes the command. All communication is automatically encrypted. The session terminates when the command completes. The SCP command does not require special privileges.

Command Synopsis 

SCP [-D debug_level] [-d] [-q] [-Q] [-p] [-u] [-v] [-h] [-r] [-k] [-B] [-a] [-v] [-1] 
[-c cipher] [-S ssh-path] [-P ssh-port] [-o ssh-option] [-b] [-N] [-V] [-h]source-name destination-name

Parameters 

source-name specifies the file to be copied.

destination-name specified the location and file name for the copied file.

The general format for the source and destination name is user@host#port:[directory]file-name. You can copy files or entire directories.

Options 

You can use the options in SCP Command Options with the SCP command.

Table 1   SCP Command Options
Option Description
-D debug-level
Displays debug information to SYS$OUTPUT. The debug-level is a number between 0 and 99, where 99 specifies that all debug information should be displayed.
-d
Makes sure that the destination-name parameter is a directory. If not, the SCP command exits with an error message.
-q
Makes SCP quiet (only fatal errors are displayed).
-Q
Suppresses the progress indicator.
-p
Preserves file attributes and timestamps.
-u
Removes source files after copying.
­-k
Replaces files of the same name at the destination. This option applies to SSH for OpenVMS servers only.
-B
Sets batch mode on.
-r
Recurses subdirectories.
-a
Transfers files in ASCII mode.
-v
Displays information in verbose mode. This is equal to specifying the -D 2 option.
-c cipher
Specifies the encryption algorithm to use. See the ciphers keyword in the client configuration file for more information (Appendix B). Each -c option can specify only one cipher; multiple -c options are allowed.
-S ssh-path
Specifies an alternate location for the SSH server executable file.
-P ssh-port
Tells SCP which port the SSH server listens on.
-o ssh-option
Specifies client configuration options that override any options specified in the client configuration file (see SSH Client and Server Configuration Files).
-b
Defines the maximum buffer size for one request (default is 2048 bytes).
-N
Defines the maximum buffer size of concurrent requests (default is 10).
-V
Displays the version of SSH.
-h
Displays information about using the SCP utility.

Example 

The following example shows how to copy files from a local system FILE.TXT to a remote system (VMSHOST) and into the directory [MYDIR].

$ SCP FILE.TXT KATHY@VMSHOST:DSK0:[MYDIR]
The following example shows how to copy FILE.TXT from a remote system (VMSHOST) to a local system and renaming it to LOCAL_FILE.TXT:
$ SCP KATHY@VMSHOST:DSK0:[MYDIR]FILE.TXT LOCAL_FILE.TXT

Using the SFTP Command 

You can use the SFTP command on a client to copy files to and from a server. Some SFTP commands and syntax are similar to those for the FTP command, but SFTP does not use the FTP server or the FTP client for its connections. The SFTP command runs with normal user privileges.

Command Synopsis 

SFTP [-D ] [-b batchfile] [-S path][-h][-v] [-P ssh-port] user@host 
For more details about SFTP commands, enter help or help topic at the sftp> prompt. For example, to find more information about the open command, enter the following command:

sftp> help open

Parameters 

The user@host parameter specifies the user name and host name of the destination for the file transfer.

Options

You can use the options in SFTP Command Options with the SFTP command.

Table 2   SFTP Command Options
Option Description
-D debug-level
Displays debug information. The debug-level value is a number between 0 and 99, where 99 specifies that all debug information should be displayed.
-b batchfile
Reads commands from a file instead of from SYS$INPUT.
-S ssh-path
Specifies an alternate location for the SSH server executable file.
-h
Displays information about how to use the SFTP utility.
-V
Displays the version of SSH.
-P
Tells SFTP on which port the SSH server is listening.

Example 


go to previous page: Before You Begin Before You Begin
go to next page: Remote Login and Command Execution with the SSH CommandRemote Login and Command Execution with the SSH Command