Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

-q option in Net::OpenSSH

by web (Initiate)
on May 08, 2012 at 18:56 UTC ( [id://969521]=perlquestion: print w/replies, xml ) Need Help??

web has asked for the wisdom of the Perl Monks concerning the following question:

When I use ssh(1) from the command line I like to use the "-q" option to silence the legalese found on some servers with public access.

My question: how do I achieve this using Net::OpenSSH?

I have tried using the ssh_opts parameter to no avail.

Replies are listed 'Best First'.
Re: -q option in Net::OpenSSH
by salva (Canon) on May 08, 2012 at 21:04 UTC
    You can use master_opts to pass options to the master SSH connection or just master_stderr_discard to get its output redirected to /dev/null.
      Thanks! This was the solution. I used the %opts has on my call to new() and included master_stderr_discard => 1, inside that hash which I was already using for "user" and "password". Thanks again. You Monks rock! *grin*
        Is there a way to combine
        master_opts => [-o => "StrictHostKeyChecking=no", ], master_stderr_dis +card => 1
        in one %opts ? Thanks.
Re: -q option in Net::OpenSSH
by kennethk (Abbot) on May 08, 2012 at 19:25 UTC

    So, according to the Net::OpenSSH docs,

    quiet => 0

    By default, scp is called with the quiet flag -q enabled in order to suppress progress information. This option allows reenabling the progress indication bar.

    Is that what you tried? Can you show us your code, so we can replicate?

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      First of all, I was using SSH not SCP. And since the "quiet" option only applies to SCP, this suggestion, while appreciated, was not applicable. My code was initially using ssh_opts. I tried applying this as a hash option to $ssh->open2pty() but that did not work. I finally used the suggestion from "salva" to include master_stderr_discard => 1, in the %opts hash on the call to new(). Thanks again.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://969521]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2024-04-19 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found