mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-08 10:30:24 +08:00
SSH认证支持sudo
This commit is contained in:
@@ -97,6 +97,12 @@ func (this *NodeInstaller) Install(dir string, params interface{}, installStatus
|
||||
// 修改配置文件
|
||||
{
|
||||
configFile := dir + "/edge-node/configs/api.yaml"
|
||||
|
||||
// sudo之后我们需要修改配置目录才能写入文件
|
||||
if this.client.sudo {
|
||||
_, _, _ = this.client.Exec("chown " + this.client.User() + " " + filepath.Dir(configFile))
|
||||
}
|
||||
|
||||
var data = []byte(`rpc:
|
||||
endpoints: [ ${endpoints} ]
|
||||
nodeId: "${nodeId}"
|
||||
@@ -108,7 +114,7 @@ secret: "${nodeSecret}"`)
|
||||
|
||||
_, err = this.client.WriteFile(configFile, data)
|
||||
if err != nil {
|
||||
return errors.New("write 'configs/api.yaml': " + err.Error())
|
||||
return errors.New("write '" + configFile + "': " + err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user