set HOME=/perm/home for persistent configs in interactive usage

As a welcome side effect, this enables persistent shell history by default!
This commit is contained in:
Michael Stapelberg 2022-03-31 19:32:11 +02:00
parent 0ee50d0171
commit 0a14bc7f0c

4
ssh.go
View File

@ -314,7 +314,9 @@ func (s *session) request(ctx context.Context, req *ssh.Request) error {
cmd = exec.CommandContext(ctx, cmdline[0], cmdline[1:]...)
}
log.Printf("Starting cmd %q", cmd.Args)
cmd.Env = expandPath(s.env)
env := expandPath(s.env)
env = append(env, "HOME=/perm/home")
cmd.Env = env
cmd.SysProcAttr = &syscall.SysProcAttr{}
if s.ttyf == nil {