diff --git a/ssh/tailssh/incubator.go b/ssh/tailssh/incubator.go index 2a6d4f2f2..41b1a397c 100644 --- a/ssh/tailssh/incubator.go +++ b/ssh/tailssh/incubator.go @@ -1273,6 +1273,9 @@ func envForUser(u *userMeta) []string { return []string{ fmt.Sprintf("SHELL=%s", u.LoginShell()), fmt.Sprintf("USER=%s", u.Username), + // Some systems require $LOGNAME. Just like OpenSSH sshd, set it to the + // same value as $USER. + fmt.Sprintf("LOGNAME=%s", u.Username), fmt.Sprintf("HOME=%s", u.HomeDir), fmt.Sprintf("PATH=%s", defaultPathForUser(u)), } diff --git a/ssh/tailssh/incubator_test.go b/ssh/tailssh/incubator_test.go index d72c049b1..c74901e20 100644 --- a/ssh/tailssh/incubator_test.go +++ b/ssh/tailssh/incubator_test.go @@ -178,9 +178,9 @@ func TestIncubatorEnvServerOnly(t *testing.T) { } } } - // USER/HOME come from the server; TERM is the one client-controlled value - // allowed in (OpenSSH parity). - for _, want := range []string{"USER=alice", "HOME=/home/alice", "TERM=xterm-256color"} { + // USER/LOGNAME/HOME come from the server; TERM is the one client-controlled + // value allowed in (OpenSSH parity). + for _, want := range []string{"USER=alice", "LOGNAME=alice", "HOME=/home/alice", "TERM=xterm-256color"} { if !slices.Contains(env, want) { t.Errorf("%q missing from child environment: %q", want, env) }