正如标题所描述的,x/cryto/ssh服务器是否支持AcceptEnv配置?
如果它支持,如何做到这一点或源代码在哪里?
发布于 2021-03-05 15:25:36
在github.com/golang/crypto中找不到AcceptEnv本身( x/crypto/ssh的源代码来自这里)
当x/crypto/ssh用作SSH客户端(如this gist或项目melbahja/goph)时,必须在服务器/etc/ssh/sshd_config文件中设置AcceptEnv行。
// 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()但当用作服务器时,这似乎并不直接受支持。
https://stackoverflow.com/questions/66487771
复制相似问题