ensure $HOME directory exists

This commit is contained in:
Michael Stapelberg 2022-09-18 21:18:04 +02:00
parent de86d50573
commit 3d820b07fa

7
ssh.go
View File

@ -343,6 +343,13 @@ func (s *session) request(ctx context.Context, req *ssh.Request) error {
return scpSink(s.channel, req, cmdline)
}
// Ensure the $HOME directory exists so that shell history works without
// any extra steps.
if err := os.MkdirAll("/perm/home", 0755); err != nil {
// TODO: Suppress -EROFS
log.Print(err)
}
var cmd *exec.Cmd
if shell := findShell(); shell != "" {
cmd = exec.CommandContext(ctx, shell, "-c", r.Command)