2017-05-23 21:34:22 +01:00
|
|
|
diff --git a/shells/bash.go b/shells/bash.go
|
2018-10-01 22:37:25 +01:00
|
|
|
index 673f4765..a58cc5e2 100644
|
2017-05-23 21:34:22 +01:00
|
|
|
--- a/shells/bash.go
|
|
|
|
+++ b/shells/bash.go
|
2018-10-01 22:37:25 +01:00
|
|
|
@@ -5,6 +5,7 @@ import (
|
|
|
|
"bytes"
|
|
|
|
"fmt"
|
2017-05-23 21:34:22 +01:00
|
|
|
"io"
|
|
|
|
+ "os/exec"
|
|
|
|
"path"
|
|
|
|
"runtime"
|
|
|
|
"strconv"
|
2018-10-01 22:37:25 +01:00
|
|
|
@@ -225,7 +226,11 @@ func (b *BashShell) GetConfiguration(info common.ShellScriptInfo) (script *commo
|
2017-05-23 21:34:22 +01: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 {
|
|
|
|
+ shellPath = "/bin/"+b.Shell
|
|
|
|
+ }
|
|
|
|
+ script.Arguments = append(script.Arguments, "-s", shellPath)
|
|
|
|
}
|
|
|
|
script.Arguments = append(script.Arguments, info.User)
|
2018-10-01 22:37:25 +01:00
|
|
|
script.Arguments = append(script.Arguments, "-c", shellCommand)
|
|
|
|
--
|
|
|
|
2.18.0
|
|
|
|
|