C.72 ScpTask

The ScpTask copies files to and from a remote host using scp. This task requires the PHP SSH2 extension to function.

Table C.95: Attributes

NameTypeDescriptionDefaultRequired
hostStringRemote hostnoneYes
portIntegerRemote port22No
usernameStringUsername to use for the connectionnoneYes
passwordStringPassword to use for the connectionnoneNo
pubkeyfileStringPublic key file (OpenSSH format) to use for the connectionnoneNo
privkeyfileStringPrivate key file (OpenSSH format) to use for the connectionnoneNo
privkeyfilepassphraseStringPrivate key file passphrase to use for the connectionnoneNo
autocreateBooleanWhether to autocreate remote directoriestrueNo
todirStringDirectory to put file(s) innoneNo
fileStringFilename to usenoneNo
fetchBooleanWhether to fetch (instead of copy to) the filefalseNo
levelStringControl the level at which the task reports status messages. One of error, warning, info, verbose, debug.verboseNo

C.72.1 Example

<scp username="john" password="smith"
host="webserver" fetch="true"
todir="/home/john/backup"
file="/www/htdocs/test.html" />

Fetches a single file from the remote server.

<scp username="john" password="smith"
host="webserver"
todir="/www/htdocs/"
file="/home/john/dev/test.html" />

Copies a single file to the remote server.

<scp username="john" password="smith"
host="webserver" todir="/www/htdocs/project/">
    <fileset dir="test">
        <include name="*.html" />
    </fileset>
</scp>

Copies multiple files to the remote server.

C.72.2 Supported Nested Tags

  • fileset

  • sshconfig

    Sometimes it is necessary to set specific configuration parameters on the ssh connection when connecting to a remote server. You can set them with the sshconfig nested tag. Set the parameters to specify connection and encryption options. These are the parameters as specified by the $methods parameter of the ssh2_connect function. See ssh2_connect for more information

    sshconfig can also be used as project level parameter with a refid so the same parameters can be re-used across a project easily.

    Table C.96: Attributes

    NameTypeDescriptionDefaultRequired
    kexStringList of key exchange methods to advertise, comma separated in order of preference.n/aNo
    hostkeyStringList of hostkey methods to advertise, come separated in order of preference.n/aNo
    clientNested TagElement containing attributes crypt, comp, and mac method preferences for messages sent from client to server. All attributes are optional.n/aNo
    serverNested TagElement containing attributes crypt, comp, and mac method preferences for messages sent from server to client. All attributes are optional.n/aNo