[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

Copying Files

 » Table of Contents

 » Glossary

 » Index

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

  • SCP (or SCP2)

  • SFTP (or SFTP2)

File Types

You can use SCP and SFTP to copy files of the following types:

  • Variable-length

  • VFC

  • Fixed

  • Fortran Carriage Control

  • Stream-LF

Files that are indexed or relative cannot be copied directly. To transfer indexed files:

  1. Create an encoded copy of the file with sequential organization with any one of the following options:

    • Backup saveset

    • Self-extracting image (such as from SPOOL COMPRESS /METHOD=DCX_AXPEXE)

    • Zip archive

  2. Transfer the converted file.

  3. Convert back on the receiving end.

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 -dqQpuBrav146Vh] debug_level_spec]
[-c cipher] [-S ssh2-path]
[-P ssh-port]-b buf_size]
[-N max_requests] [-o ssh-option]
source-name destination-name

Parameters

source-name specifies the file to be copied, in the following format:

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

The general format for the source and destination name is as follows:

user@host#port :[directory]file-name

You can copy files or entire directories.

Options

Table 7–1 describes the options in you can use with the SCP command.

Table 7-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.

-k

Replaces files of the same name at the destination. This option applies to OpenVMS SSH servers only.

-B

Sets batch mode on.

-v

Displays information in verbose mode. This is equal to specifying the -D 2 option.

-1

Engage scp1 compatibility.

-4

Restricts communications to IPv4 networking. This is the default.

-6

Enables IPv6 networking.

-c cipher

Specifies the encryption algorithm to use. See the description of the ciphers configuration parameter in the client configuration file described in Appendix B. The -c option specifies one cipher; multiple -c options are allowed.

-S ssh-path

Specifies an alternate location for the SSH server executable file.

-P ssh-port

Specifies the port on which the SSH Server should listen for SCP connections.

-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).

-o ssh-option

Specifies client configuration parameter settings that override the settings specified in the client configuration file. For more information, see Appendix B.

-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.

Command Synopsis

SFTP [-D debug_level_spec][-B batchfile] [-S path][-h] [-V] [-P ssh-port]
[b buffer_size] [-4] [-6][-o ssh_option]
user@host

For more details about SFTP commands, enter the help or help topic command 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

Table 7–2 describes the options you can use with the SFTP command.

Table 7-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 batchfileReads commands from a file instead of from SYS$INPUT. The default batch file is SYS$LOGIN:TCPIP$SFTP_BATCHFILE.TXT. If you specify a different batch file, make sure the batch file is in Stream-LF format.

-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.

-b buffer-size

Specifies the buffer size.

-4

Restricts communications to IPv4 networking.

-6

Enables IPv6 networking.

-o SSH-option

Specifies additional SSH options.
 

Example

The following example shows how to invoke SFTP. Enter SFTP commands at the sftp> prompt. For a list of SFTP commands, enter the help command at the sftp> prompt. For example:

$ SFTP
sftp> help