NAME
XAS::Lib::SSH::Client - A SSH based client
SYNOPSIS
use XAS::Lib::SSH::Client;
my $client = XAS::Lib::SSH::Client->new(
-server => 'auburn-xen-01',
-username => 'root',
-password => 'secret',
);
$client->connect();
$client->put($data);
$data = $client->get();
$client->disconnect();
DESCRIPTION
The module provides basic network connectivity along with input/output methods using the SSH protocol. It can authenticate using username/password or username/public key/private key/password.
METHODS
new
This initializes the object. It takes the following parameters:
- -username
-
An optional username to use when connecting to the server.
- -password
-
An optional password to use for authentication.
- -pub_key
-
An optional public ssh key file to use.
- -priv_key
-
An optional private ssh key to use.
- -server
-
The server to connect too. Defaults to 'localhost'.
- -port
-
The port to use on the server. It defaults to 22.
- -timeout
-
The number of seconds to timeout writes. It must be compatible with IO::Select. Defaults to 0.2.
connect
This method makes a connection to the server.
setup
This method sets up the channel to be used. It needs to be overridden to be useful.
get
This method reads date from the channel. It uses non-blocking reads. It will attempt to read all pending data.
put($buffer)
This method will write data to the channel. It uses non-blocking writes. It will attempt to write all the data in the buffer.
disconnect
This method closes the connection.
MUTATORS
attempts
This is used when reading data from the channel. It triggers how many times to attempt reading from the channel when a LIBSSH2_ERROR_EAGAIN error occurs. The default is 5 times.
SEE ALSO
AUTHOR
Kevin L. Esteb, <kevin@kesteb.us>
COPYRIGHT AND LICENSE
Copyright (C) 2014 Kevin L. Esteb
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
See http://dev.perl.org/licenses/ for more information.