forked from tildetown/town
call adduser, usermod
parent
3940fe58ae
commit
6741079152
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"net/mail"
|
||||
"os"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
|
@ -260,9 +261,19 @@ Your invite code has not been marked as used and you're welcome to try again, th
|
|||
return nil
|
||||
}
|
||||
|
||||
func createUser(data newUserData) error {
|
||||
// TODO adduser
|
||||
// TODO add to town group
|
||||
// TODO add logging like the signup tool has
|
||||
|
||||
func createUser(data newUserData) (err error) {
|
||||
cmd := exec.Command("sudo", "/usr/sbin/adduser", "--quiet", "--disabled-password", data.Username)
|
||||
if err = cmd.Run(); err != nil {
|
||||
return fmt.Errorf("adduser failed: %w", err)
|
||||
}
|
||||
|
||||
cmd = exec.Command("sudo", "/usr/sbin/usermod", "-a", "-G", "town", data.Username)
|
||||
if err = cmd.Run(); err != nil {
|
||||
return fmt.Errorf("usermod failed: %w", err)
|
||||
}
|
||||
|
||||
// TODO create keyfile by running helper (helper should also make ~/.ssh)
|
||||
// TODO generate welcome gift
|
||||
// TODO any alerts
|
||||
|
|
Loading…
Reference in New Issue