Help for this page

Select Code to Download


  1. or download this
    my $fnpubcert = "/home/localusername/.ssh/id_rsa.pub";
    open my $fhpubcert, '<', $fnpubcert or die "error opening $fnpubcert $
    +!";
    my $mypubcert = do { local $/; <$fhpubcert> };
    
  2. or download this
    my $cmd = "echo $mypubcert > /home/remoteusername/.ssh/authorized_keys
    +";
    my ($stdout,$stderr,$exit) = $ssh->cmd("$cmd");
    ...
    my $cmd = 'chown remoteusername.remoteusername /home/remoteusername/.s
    +sh/authorized_keys; chmod 600 /home/remoteusername/.ssh/authorized_ke
    +ys';
    my ($stdout,$stderr,$exit) = $ssh->cmd("$cmd");
    if ($stdout || $stderr) { print "STDOUT: $stdout STDERROR: $stderr\n";
    + }
    
  3. or download this
    my $cmd = "cat > /home/vmsys/.ssh/authorized_keys";
    print $mypubcert | my ($stdout,$stderr,$exit) = $ssh->cmd("$cmd");