Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
Connector::Builtin::FiUserSContributed Perl DoConnector::Builtin::File::SCP(3)


       Read/Write files	to/from	a remote host using SCP.

	   The target host specification, minimal the hostname,	optional
	   including username and a base path specification. Valid examples

	   Note: If the	connector is called with arguments, those are used to
	   build a filename / path which is appended to	the target
	   specification. If you call the connector without arguments, you
	   need	to set the noargs parameter and	must LOCATION point to a file
	   (otherwise you will end up with the temporary file name used	as
	   target name).

	   Set to true,	if you want to use the value given by LOCATION as
	   final target. This makes additional path arguments and the
	   file/path parameter useless.

	   Pattern for Template	Toolkit	to build the filename. The connector
	   path	components are available in the	key ARGS. In set mode the
	   unfiltered data is also available in	key DATA. The result is
	   appended to LOCATION.  NB: For security reasons, only word, space,
	   dash, underscore and	dot are	allowed	in the filename. If you	want
	   to include a	directory, add the path	parameter instead!

	   Same	as file, but allows the	directory seperator (slash and
	   backslash) in the resulting filename. Use this for the full path
	   including the filename as the file parameter	is not used, when path
	   is set!

	   By default, the file	is created with	restrictive permissions	of
	   0600. You can set other permissions using filemode. Due to perls
	   lack	for variable types, you	must give this either as octal number
	   with	leading	zero or	as string without the leading zero. Otherwise
	   you might get wrong permissions.

	   Pattern for Template	Toolkit	to build the content. The data is
	   passed "as is". If data is a	scalar,	it is wrapped into a hash
	   using DATA as key.

       command,	optional
	   Path	to the scp command, default is /usr/bin/scp.

       port, optional
	   Port	to connect to, added with "-P" to the command line.

       identity, optional
	   Path	to an ssh identity file, added with "-i" to the	command	line.

       sshconfig, optional
	   Path	to an ssh client configuration,	added with "-F"	to the command

       timeout,	optional
	   Abort the transfer after timeout seconds.

Supported Methods
       Write data to a file.

	   $conn->set('filename', { NAME => 'John Doe',	'ROLE' => 'Administrator' });

       See the file parameter how to control the filename.

       Fetch data from a file. See the file parameter how to control the

	   my $data = $conn->set('filename');

	   my $conn = Connector::Builtin::File::SCP->new({
	      LOCATION => 'localhost:/var/data',
	      file => '[% ARGS.0 %].txt',
	      content => ' Hello [% NAME %]',
	      filemode => 0644

	   $conn->set('test', {	NAME =>	'John Doe' });

       Results in a file /var/data/test.txt with the content Hello John	Doe.

A note on security
       To enable the scp transfer, the file is created on the local disk using
       tempdir/tempfile. The directory is created with permissions only	for
       the current user, so no other user than root and	yourself is able to
       see the content.	The tempfile is	cleaned	up immediatly, the directory
       is handled by the internal garbage collection.

       Hey! The	above document had some	coding errors, which are explained

       Around line 384:
	   Unknown directive: =filemode

perl v5.24.1			  2016-12-01  Connector::Builtin::File::SCP(3)

Name | Description | Parameters | Supported Methods | Example | A note on security | POD ERRORS

Want to link to this manual page? Use this URL:

home | help