2017-05-23 20:34:22 +00:00
|
|
|
diff --git a/shells/bash.go b/shells/bash.go
|
2022-03-22 14:39:37 +00:00
|
|
|
index 18d608445..f158ffc0b 100644
|
2017-05-23 20:34:22 +00:00
|
|
|
--- a/shells/bash.go
|
|
|
|
+++ b/shells/bash.go
|
2021-12-23 11:35:24 +00:00
|
|
|
@@ -3,6 +3,7 @@ package shells
|
|
|
|
import (
|
2018-10-01 21:37:25 +00:00
|
|
|
"bytes"
|
|
|
|
"fmt"
|
2017-05-23 20:34:22 +00:00
|
|
|
+ "os/exec"
|
|
|
|
"path"
|
|
|
|
"runtime"
|
|
|
|
"strconv"
|
2022-03-22 14:39:37 +00:00
|
|
|
@@ -307,7 +308,11 @@ func (b *BashShell) GetConfiguration(info common.ShellScriptInfo) (*common.Shell
|
|
|
|
|
|
|
|
script.Command = "su"
|
|
|
|
if runtime.GOOS == OSLinux {
|
|
|
|
- script.Arguments = []string{"-s", "/bin/" + b.Shell, info.User, "-c", script.CmdLine}
|
|
|
|
+ shellPath, err := exec.LookPath(b.Shell)
|
|
|
|
+ if err != nil {
|
|
|
|
+ shellPath = "/bin/" + b.Shell
|
|
|
|
+ }
|
|
|
|
+ script.Arguments = []string{"-s", shellPath, info.User, "-c", script.CmdLine}
|
|
|
|
} else {
|
|
|
|
script.Arguments = []string{info.User, "-c", script.CmdLine}
|
|
|
|
}
|