MCPcopy Create free account
hub / github.com/tailscale/tailcat / loginShell

Function loginShell

tailcat_ssh.go:289–303  ·  view source on GitHub ↗

loginShell returns the user's login shell.

(u *user.User)

Source from the content-addressed store, hash-verified

287
288// loginShell returns the user's login shell.
289func loginShell(u *user.User) string {
290 switch runtime.GOOS {
291 case "darwin":
292 out, err := exec.Command("dscl", ".", "-read", filepath.Join("/Users", u.Username), "UserShell").Output()
293 if err == nil {
294 if s, ok := strings.CutPrefix(string(out), "UserShell: "); ok {
295 return strings.TrimSpace(s)
296 }
297 }
298 }
299 if e := os.Getenv("SHELL"); e != "" {
300 return e
301 }
302 return "/bin/sh"
303}
304
305// defaultPath returns the default PATH for the given user.
306func defaultPath(u *user.User) string {

Callers 1

sessionHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected