Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Net::SCP::Expect wierdness

by blue_cowdawg (Monsignor)
on Aug 29, 2012 at 20:43 UTC ( #990564=perlquestion: print w/replies, xml ) Need Help??
blue_cowdawg has asked for the wisdom of the Perl Monks concerning the following question:

OK.. so I'm using Net::SCP::Expect to automate some of my work. Check this bit of code:

my $scpe= new Net::SCP::Expect ( host => 'myhost', user => 'myaccount', password => 'secret', recursive => 1, preserve => 1, compress => 1, no_check => 1, timeout => 60, ); $scpe -> scp ("/home/path/whatever", "myaccount@myhost:/tmp/" );

I've put as much of the code as I dare but that is the essence and I bomb out with

scp timed out while trying to connect to myhost at script  line 122

I add a single line in the "new" call:

verbose => 1
and the darn thing works. I hate to think I have to deal with the ugly output verbose mode gives, but it does make the script work.

Thoughts anybody?


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

Replies are listed 'Best First'.
Re: Net::SCP::Expect wierdness
by salva (Abbot) on Aug 29, 2012 at 20:56 UTC
    Maybe the internal timer used by Net::SCP::Expect is reset every time something arrives through the tty. Have you tried increasing the timeout value?

    Alternatively, try using Net::SSH2 or transferring the file via SFTP with Net::SFTP::Foreign.

          Maybe the internal timer used by Net::SCP::Expect is reset every time something arrives through the tty. Have you tried increasing the timeout value?

      Yes I did to ridiculous values. 900 seconds? really? Still didn't work for me.

      <ul
        transferring the file via SFTP with Net::SFTP::Foreign.

    Tried that too and it did not work for all the hosts I have to do transfers to.

    This problem is driving me nuts... and I'm already close enough to walk.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
        Are you able to transfer the files using scp from the command line with the -q flag set?

        Have you tried upgrading your client machine to the latest version of OpenSSH?

        What are exactly the kind of problems you see when using SFTP? Is it disabled in some host?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://990564]
Approved by toolic
Front-paged by Corion
help
Chatterbox?
[Corion]: But yes, "who started this process" is interesting information :)
[tye]: no, I really believe that "login user" was added as a fundamental bit of info about each process in order to enhance the usefulness of auditing
[Corion]: Ah - if that information is saved in a file, then you could theoretically spam that file and confuse getlogin(). So, don't use it for authentication :)
[tye]: that is what getlogin() certainly *used* to do. I don't believe that is what it certainly should do.
[davido]: /var/run/utmp is 664 i think.
[tye]: Note that my "man getlogin" says that it uses stdin when it should use /dev/tty (calling a glibc bug). But that does not appear to be the case when I test it. But maybe Perl's getlogin() is not using glibc's getlogin().
[oiskuu]: well, run a strace and see what the getlogin does for you.... As I said. SELinux probably has those security labels. But not regular linux.
[tye]: for example, read https://unix. stackexchange.com/ questions/146138/ loginuid-should-be -allowed-to-change -or-not-mutable-or -not
[tye]: I'm not using SELinux and it certainly appears to disagree with you. shrug
[tye]: Since you brought up /proc, oiskuu, I didn't see you respond to my suggestion of 'loginuid'. Does your /proc not have such?

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2017-06-23 19:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (554 votes). Check out past polls.