Skip to content
This repository has been archived by the owner on Feb 20, 2020. It is now read-only.

Commit

Permalink
Bug 1592233 - calculate UID for new user under macOS multiuser
Browse files Browse the repository at this point in the history
  • Loading branch information
petemoore committed Oct 29, 2019
1 parent 297253f commit 1bcd32f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions runtime/runtime_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ func (user *OSUser) CreateNew(okIfExists bool) (err error) {
fullname="${0}"
password="${1}"
echo "Creating user '${username}' with home directory '${homedir}' and password '${password}'..."
maxid=$(dscl . -list '/Users' 'UniqueID' | awk '{print $2}' | sort -ug | tail -1)
uid=$((maxid+1))
/usr/bin/sudo dscl . -create "/Users/${username}"
/usr/bin/sudo dscl . -create "/Users/${username}" 'UserShell' '/bin/bash'
/usr/bin/sudo dscl . -create "/Users/${username}" 'RealName' "${fullname}"
Expand Down

0 comments on commit 1bcd32f

Please sign in to comment.