Use login shells in terminals

This commit is contained in:
Alfonso Acosta
2016-08-22 17:42:38 +00:00
parent 32edfc9112
commit b7b64a7975
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ func (r *registry) execContainer(containerID string, req xfer.Request) xfer.Resp
AttachStdout: true,
AttachStderr: true,
Tty: true,
Cmd: []string{"/bin/sh", "-c", "TERM=xterm exec $( (type getent > /dev/null 2>&1 && getent passwd root | cut -d: -f7 2>/dev/null) || echo /bin/sh)"},
Cmd: []string{"/bin/sh", "-l", "-c", "TERM=xterm exec $( (type getent > /dev/null 2>&1 && getent passwd root | cut -d: -f7 2>/dev/null) || echo /bin/sh)"},
Container: containerID,
})
if err != nil {
+1 -1
View File
@@ -1,5 +1,5 @@
package host
func getHostShellCmd() []string {
return []string{"/bin/bash"}
return []string{"/bin/bash", "-l"}
}
+2 -2
View File
@@ -23,12 +23,12 @@ func getHostShellCmd() []string {
"/usr/bin/nsenter", "-t1", "-m", "-i", "-n", "-p", "--no-fork",
"--setuid", uid,
"--setgid", gid,
shell,
shell, "-l",
}
}
_, _, shell := getRootUserDetails([]string{"cat", "/etc/passwd"})
return []string{shell}
return []string{shell, "-l"}
}
func getRootUserDetails(readPasswdCmd []string) (uid, gid, shell string) {