2020-04-24 23:36:52 +00:00
|
|
|
diff --git a/shells/bash.go b/shells/bash.go
|
2021-12-24 04:21:11 +00:00
|
|
|
index bd99eca1a..9873dff6b 100644
|
2020-04-24 23:36:52 +00:00
|
|
|
--- a/shells/bash.go
|
|
|
|
+++ b/shells/bash.go
|
2021-12-24 04:21:11 +00:00
|
|
|
@@ -3,6 +3,7 @@ package shells
|
|
|
|
import (
|
2020-04-24 23:36:52 +00:00
|
|
|
"bytes"
|
|
|
|
"fmt"
|
|
|
|
+ "os/exec"
|
|
|
|
"path"
|
|
|
|
"runtime"
|
|
|
|
"strconv"
|
2021-12-24 04:21:11 +00:00
|
|
|
@@ -300,7 +301,11 @@ func (b *BashShell) GetConfiguration(info common.ShellScriptInfo) (*common.Shell
|
2020-04-24 23:36:52 +00:00
|
|
|
if info.User != "" {
|
|
|
|
script.Command = "su"
|
|
|
|
if runtime.GOOS == "linux" {
|
|
|
|
- script.Arguments = append(script.Arguments, "-s", "/bin/"+b.Shell)
|
|
|
|
+ shellPath, err := exec.LookPath(b.Shell)
|
|
|
|
+ if err != nil {
|
2021-12-24 04:21:11 +00:00
|
|
|
+ shellPath = "/bin/" + b.Shell
|
2020-04-24 23:36:52 +00:00
|
|
|
+ }
|
|
|
|
+ script.Arguments = append(script.Arguments, "-s", shellPath)
|
|
|
|
}
|
2021-12-24 04:21:11 +00:00
|
|
|
script.Arguments = append(
|
|
|
|
script.Arguments,
|