NAME
Rex::LibSSH - Rex connection backend using Net::LibSSH (no SFTP required)
VERSION
version 0.002
SYNOPSIS
# In your Rexfile
use Rex -feature => ['1.4'];
use Rex::LibSSH;
set connection => 'LibSSH';
task 'deploy', 'myserver', sub {
my $kernel = run 'uname -r';
say "kernel: $kernel";
};
DESCRIPTION
Rex::LibSSH provides Rex connection, exec, filesystem, and file interfaces backed by Net::LibSSH — the XS binding for libssh.
Unlike Rex's built-in SSH and OpenSSH connection types, this backend performs all file operations (is_file, stat, ls, upload, download, etc.) over plain SSH exec channels. No SFTP subsystem is required on the remote host.
This makes it suitable for minimal containers, embedded systems, and any host where Rex would otherwise crash with:
Can't call method "stat" on an undefined value
Activating
Set the connection type in your Rexfile before connecting:
set connection => 'LibSSH';
Rex's interface dispatch will automatically load Rex::Interface::Connection::LibSSH, Rex::Interface::Exec::LibSSH, Rex::Interface::Fs::LibSSH, and Rex::Interface::File::LibSSH.
Authentication
Supports public key authentication:
Rex::Config->set_private_key('/home/user/.ssh/id_ed25519');
Rex::Config->set_public_key('/home/user/.ssh/id_ed25519.pub');
Or pass keys directly to Rex::connect:
Rex::connect(
server => '10.0.0.1',
user => 'root',
private_key => '/path/to/key',
public_key => '/path/to/key.pub',
auth_type => 'key',
);
Host key checking is disabled by default (strict_hostkeycheck => 0) to avoid blocking non-interactive deploys. To enable it, pass the option when connecting:
Rex::connect(
server => '10.0.0.1',
strict_hostkeycheck => 1,
);
SEE ALSO
Net::LibSSH, Rex::Interface::Connection::LibSSH, Rex::Interface::Fs::LibSSH, Rex::Interface::File::LibSSH, Rex::Interface::Exec::LibSSH
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/rex-libssh/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <getty@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.