dougong1031 2018-07-19 01:07
浏览 135

golang ssh安静模式

In golang ssh(golang.org/x/crypto/ssh) package how to force the ssh command to use quiet mode i.e. simulate 'ssh -q'

I looked at Config and ClientConfig structures as well as tried searching for 'quiet' or options in the documentation(https://godoc.org/golang.org/x/crypto/ssh) but can't find anything.

  • 写回答

1条回答 默认 最新

  • doujiu5464 2018-07-23 23:24
    关注

    Credits: Thanks to @JimB and @Kenster for nailing this.

    Quiet mode is not required for (golang.org/x/crypto/ssh). Extra messages that you would usually see when using a ssh CLI won't appear when using (golang.org/x/crypto/ssh). Here is an example of extra messages:

    sshpass -ppassword ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no 10.10.10.10 'ls | wc -l'

    Warning: Permanently added '10.10.10.10' (ECDSA) to the list of known hosts.

    19

    sshpass -ppassword ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no 10.10.10.10 'ls | wc -l'

    19

    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line