登录
首页 >  Golang >  Go问答

x/crypto: x/crypto/ssh Does the server support AcceptEnv?

来源:stackoverflow

时间:2024-03-05 21:42:23 339浏览 收藏

一分耕耘,一分收获!既然都打开这篇《x/crypto: x/crypto/ssh Does the server support AcceptEnv?》,就坚持看下去,学下去吧!本文主要会给大家讲到等等知识点,如果大家对本文有好的建议或者看到有不足之处,非常欢迎大家积极提出!在后续文章我会继续更新Golang相关的内容,希望对大家都有所帮助!

问题内容

如标题所述,x/cryto/ssh 服务器是否支持 AcceptEnv 配置?

如果支持,怎么做或者源代码在哪里?


解决方案


acceptenv 本身未在 github.com/golang/crypto 中找到(x/crypto/ssh 的来源来自此处)

x/crypto/ssh用作ssh客户端时(如this gist或项目melbahja/goph),必须在服务器/etc/ssh/sshd_config文件中设置acceptenv行。 p>

// Get new `Goph.Cmd`
cmd, err := client.Command("ls", "-alh", "/tmp")

if err != nil {
    // handle the error!
}

// You can set env vars, but the server must be configured to `AcceptEnv line`.
cmd.Env = []string{"MY_VAR=MYVALUE"}

// Run you command.
err = cmd.Run()

但是当用作服务器时,这似乎并不直接支持。

文中关于的知识介绍,希望对你的学习有所帮助!若是受益匪浅,那就动动鼠标收藏这篇《x/crypto: x/crypto/ssh Does the server support AcceptEnv?》文章吧,也可关注golang学习网公众号了解相关技术文章。

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>