Skip to content

Instantly share code, notes, and snippets.

@masayuki5160
Last active December 22, 2015 21:09
Show Gist options
  • Save masayuki5160/6531580 to your computer and use it in GitHub Desktop.
Save masayuki5160/6531580 to your computer and use it in GitHub Desktop.
use Net::OpenSSH;
my $host = "hostname";
# ログイン認証
my $ssh = Net::OpenSSH->new(
$host,
(
user => 'username',
password => 'pass',
port => '10022',
),
);
$ssh->error and die "Can't ssh to ". $host .": " . $ssh->error;
@masayuki5160
Copy link
Author

  1. cpanmのインストール
  2. Net::OpenSSHの追加

tanaka-no-MacBook-Air:Perl masayuki5160$ curl -L http://cpanmin.us | perl - --sudo App::cpanminus
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 303 0 303 0 0 805 0 --:--:-- --:--:-- --:--:-- 12120
100 262k 100 262k 0 0 245k 0 0:00:01 0:00:01 --:--:-- 245k
--> Working on App::cpanminus
Fetching http://www.cpan.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7001.tar.gz ... OK
Configuring App-cpanminus-1.7001 ... OK
Building and testing App-cpanminus-1.7001 ... Password:
OK
Successfully installed App-cpanminus-1.7001
1 distribution installed

tanaka-no-MacBook-Air:Perl masayuki5160$ sudo -H cpanm Net::OpenSSH
--> Working on Net::OpenSSH
Fetching http://www.cpan.org/authors/id/S/SA/SALVA/Net-OpenSSH-0.60.tar.gz ... OK
Configuring Net-OpenSSH-0.60 ... OK
Building and testing Net-OpenSSH-0.60 ... OK
Successfully installed Net-OpenSSH-0.60
1 distribution installed
tanaka-no-MacBook-Air:Perl masayuki5160$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment