in reply to Re^11: Problem using Net::OpenSSH->capture to su to another user
in thread Problem using Net::OpenSSH->capture to su to another user

Hi Salva,

Unfortunaytely that doesn't work. Note I also do something similar in the ssh constructor as in:

my $ssh = Net::OpenSSH->new($master_host, user => "loguser", master_st +derr_discard => 1, expand_vars => => 1);

Anything else I can try?

Tim

Replies are listed 'Best First'.
Re^13: Problem using Net::OpenSSH->capture to su to another user
by salva (Canon) on Jun 05, 2014 at 14:26 UTC
    Both options are needed.

    Those errors are generated because you are requesting a TTY on the remote side but then there is no TTY on the local side and so when ssh tries to forward the ioctls, it gets that error back from the OS.

    Other than redirecting STDERR to /dev/null (which is what stderr_discard actually does) I don't see how that message can be suppresed.

    Use strace to see where are these msgs originate and where they go.

    Update: Updating the local OpenSSH may also help as new versions generate fewer of these useless warnings.

      Hi Salva,

      Adding the stderr_discard in both places sorted the problem. Many thanks for all your hehlp with this issue.

      Tim