Re: ssh into remote nodes, do mulitple commands



Nene wrote:
Hello,

I'm trying to use Net::SSH to ssh into 3 nodes and move/copy files
with File::Copy. For now, I scripted it to find files of a certain
age and move them.
The $cmd variable is working, but when I try to move the files, it
errors with copy failed. Please critique or suggest a better way.
[...]
sshopen2("$user\@$host", *READER, *WRITER, "$cmd") || die "ssh: $!";
print "Connected to $host\n";

while (<READER>) {

if ( $_ ) {
use File::Copy;

move("/tmp/rod","/tmp/nasty") or die "Copy failed: $!";

}

You're 'use'ing File::Copy on the machine that's running the script, not on the remote host. So your 'move' is trying to move those files on the
host machine, not $host.

Probably easiest to just do "mv /tmp/rod /tmp/nasty" in another sshopen2 or better would be to modify the find command to move the files as
part of the exec, instead of ls -lt -- which is sort of useless.
.



Relevant Pages

  • RE: sshd / ssh setup
    ... We have an Remote FreeBSD system which is located some where on the ... This method gives the maximum protection possible utilizing ssh. ... Host setup steps. ... Reboot your system to activate sshd and login as root. ...
    (freebsd-questions)
  • SSH filter transer, was Re: Soft Update - directory/file listing
    ... But SSH file transfer is painfully slow all the time. ... ## SSH 3.2 Server Configuration File ... # Note that forwardings using the name of this host will be allowed (if ...
    (freebsd-performance)
  • Re: [opensuse] Re: OpenSUSE PuTTY ?
    ... PuTTY lets you set up all kinds of special options, tied to which host ... The ssh daemon on the host machine is usually activated by default, ... As a taster to open a remote session in a new window in any konsole ... Windows users should explore Cygwin as this will allow you to run ssh ...
    (SuSE)
  • Re: Disable name canonicalization for OpenSSH GSSAPI
    ... The issue I'm having is with a new server ... I'm unable to setup the correct reverse ... When I attempt to connect to this host with SSH, ...
    (comp.protocols.kerberos)
  • Re: hacked?
    ... So I ssh'd in and did a netstat and saw what looked like an unwanted SSH connection... ... On the local host type nmap -sV localhost -p 1-65535 to see what ports respond and which apps/services. ...
    (comp.os.linux.misc)