actually sudo as user as intended

trunk
vilmibm 2023-03-04 01:02:52 +00:00
parent 6a1fcbcf32
commit 015b28ba6a
1 changed files with 1 additions and 1 deletions

View File

@ -149,7 +149,7 @@ func createUser(data newUserData) (err error) {
return fmt.Errorf("usermod failed: %w", err) return fmt.Errorf("usermod failed: %w", err)
} }
cmd = exec.Command("sudo", "/town/bin/createkeyfile", data.Username) cmd = exec.Command("sudo", "--user", data.Username, "/town/bin/createkeyfile", data.Username)
cmd.Stdin = bytes.NewBufferString(keyfileText(data)) cmd.Stdin = bytes.NewBufferString(keyfileText(data))
if err = cmd.Run(); err != nil { if err = cmd.Run(); err != nil {
return fmt.Errorf("createkeyfile failed: %w", err) return fmt.Errorf("createkeyfile failed: %w", err)