The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Quiq::Ssh - Führe Kommando per SSH aus

BASE CLASS

Quiq::Hash

DESCRIPTION

Ein Objekt der Klasse repräsentiert eine SSH-Verbindung zu einem Host. Über die Verbindung können Shell-Kommandos ausgeführt werden. Die Klasse ist ein Wrapper für die Klasse Net::SSH::Perl, die das SSH Netzprotokoll direkt spricht.

Installation

Sollte es bei der Installation von Net::SSH::Perl in Crypt::Curve25519 zu dem Fehler kommen

  curve25519-donna-c64.c:99:1: error: conflicting types for ‘fmul’
   fmul(felem output, const felem in2, const felem in) {
   ^~~~
  In file included from /home/fs2/sys/opt/perlbrew/perls/perl-5.30.0/lib/5.30.0/x86_64-linux/CORE/perl.h:2068,
                   from Curve25519.xs:3:
  /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h:30:20: note: previous declaration of ‘fmul’ was here
   __MATHCALL_NARROW (__MATHCALL_NAME (mul), __MATHCALL_REDIR_NAME (mul), 2);
              ^~~~~~~~~~~~~~~

kann dieser mit

  $ grep -rl "fmul" ./ | xargs sed -i 's/fmul/fixedvar/g'

behoben werden. Siehe: https://github.com/ajgb/crypt-curve25519/issues/9#issuecomment-447845725

EXAMPLE

Zeige den Inhalt des Homeverzeichnisses auf Host dssp an:

  $ perl -MQuiq::Ssh -E 'print Quiq::Ssh->new("dssp")->exec("ls")'

METHODS

Klassenmethoden

new() - Konstruktor

Synopsis

  $ssh = $class->new($host,@opt);

Arguments

$host

Hostname

Options

-debug => $bool (Default: 0)

Schreibe Debug-Information über die SSH-Kommunikation nach STDERR.

-loginShell => $bool (Default: 1)

Default für Methode exec(): Führe Kommandos per Login-Shell aus.

-user => $user (Default: Wert von $USER)

Name des Benutzers.

Returns

Objekt

Description

Instantiiere ein Objekt für die Ausführung von Kommandos via SSH auf Host $host über den Benutzer $user.

Objektmethoden

exec() - Führe Kommando aus

Synopsis

  ($stdout,$stderr) = $ssh->exec($cmd,@opt);
  ($stdout,$stderr,$exit) = $ssh->exec($cmd,-sloppy=>1,@opt);

Arguments

$cmd (String)

Kommandozeile

Options

-loginShell => $bool (Default: Wert der Option beim Konstruktor)

Führe das Remote-Kommando unter einer Login-Shell aus. Als Shell wird die bash verwendet.

-sloppy => $bool (Default: 0)

Wirf keine Exception, wenn das Remote-Kommando fehlschlägt, sondern liefere den Exitcode als dritten Returnwert zurück.

Returns

$stdout

Ausgabe des Kommandos auf stdout (String).

$stderr

Ausgabe des Kommandos auf stderr (String).

$exit

Exitcode des Kommandos (Integer). Wird gesetzt, wenn -sloppy=>1 ist, sonst konstant 0.

VERSION

1.190

AUTHOR

Frank Seitz, http://fseitz.de/

COPYRIGHT

Copyright (C) 2020 Frank Seitz

LICENSE

This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.