Skip to content

Commit

Permalink
Fix setting password for user
Browse files Browse the repository at this point in the history
  • Loading branch information
pkgdemon committed Jan 14, 2024
1 parent 72414fc commit a4eb177
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions installer/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,11 @@ def user():
"""
Creates the users and groups.
"""
# Add user and set password
# Add user
subprocess.run(["chroot", MNT, "useradd", "-m", "-g", "users", "-G", "wheel", USERNAME], check=True)
subprocess.run(["chroot", MNT, "echo", f"{USERNAME}:{PASSWORD}", "|", "chpasswd"], check=True)

# Set PASSWORD for the user
subprocess.run(["chroot", MNT, "chpasswd"], input=f"{USERNAME}:{PASSWORD}\n", text=True, check=True)

# Enable sudo for the wheel group
subprocess.run(["chroot", MNT, "sed", "-i", "/%wheel ALL=(ALL) ALL/s/^# //", "/etc/sudoers"], check=True)
Expand Down

0 comments on commit a4eb177

Please sign in to comment.