Store::SFTP
- Class to define SFTP store that perform sftp operations between a local- and remote location.
Used in the same way as the Store-class. See the Store-class for more information.
Class to perform sftp-operations between a local- and remote location.
The class is a wrapper around the scp-command utility.
Because of limitiations in the scp-command this class does not accept the characters carriage return, new line or quote or doublequote in the "remote" and "local"-parameters since it compromises the security of running commands on the command-line. If this is a problem for the filenames or folders being used, please use another Store-class for the transfer.
These additional parameters are special to the SFTP-class and are to be used with the open()-method:
knownhosts The knownhosts-file entry that identifies the host that one connects to. It is basically the publickey in the same format as in a SSH knownhosts-file. When this option is specified it creates a random file in /tmp that contains the host-name and the publickey when the open()-method is called. It also appends the sshoptions-parameter in both the get- and put-command to add the option "-o UserKnownHostsFile" and sets it to the temporary file. This means that the host-parameter should not be changed after the open()- method has been called as it could make the host-name in the temporary knownhosts-file invalid. When the DESTROY-method is called it unlinks the temporary knownhosts-file.
passwordfile This parameter must be specified if the authentication mode set to the new()-method is AUTH_PWFILE. It basically defines the location and name of the file to read the password from for the user connecting through SSH to get/put data on the remote location.
privatekey This parameters must be specified if the authentication mode set to the new()-method is AUTH_KEY. The key specified here is in the same format as in the .ssh/id_rsa-file. The parameter is written to a random file in /tmp that is used as the privatekey/identity file when connecting through SSH to the remote location. When the DESTROY()-method is called it unlinks the temporary privatekey-file.
It is used in the same way as the Store-class. See the Store-class for more information.
Constructor is inherited from the Store-class. See the Store-class for more information.
It returns the instantiated class.
Defines the parameters used on the SFTP-store. This methods is inherited from the Store-class. See the Store-class for more information.
Creates the necessary StoreProcess-instances used by the SFTP-store.
It basically creates StoreProcess::Shell-instances for both GET-, PUT- and DEL-operations and inputs the necessary Parameter::Group-class parameters.
This method has overridden a Store-class method. See the Store-class for more information.
Calculates the size of the remote area designated by the parameter "remote".
It uses the ssh-utility and the command "ls" to recursively list the folder and sub-folders and then add the size of the elements found.
Returns the size in Bytes. See the Store-class for more information on this method.
Lists a designated folder on the remote Store.
Input parameter is "path". If none given it lists the root of the remote area.
Uses the ssh-utility and the command "ls" to list the folder in question.
Returns a HASH-reference structure upon success. Please the Store-class for more information on this method.