Hello, I am working on application which licenses depends on number of user sessions which logged in. The problem is the application "Migration Assistant" creates new session for "Setup User" and it leads to licenses leak.
# cat /etc/passwd | grep Setup
_mbsetupuser:*:248:248:Setup User:/var/setup:/bin/bash
Are there any difference between _mbsetupuser and users which is created by administrator via "System Settings" or dscl? (e.g. specific user id range which using is restricted by system). Are there any way to detect _mbsetupuser and be sure this user is predefined during system install?
Thank you in advance, Pavel
The name and structure of _mbsetupuser
is an implementation detail, so there are no good answers to your questions. This stuff has changed in the past and may well change again in the future.
Taking a step back, I think there’s a reasonable way to approach your overall problem: Check whether the account is hidden. If it is, the user can’t reasonable log into that account and thus it shouldn’t factor into your tracking.
You can do relatively easily with the (very obscure) Collaboration framework:
import Foundation
import Collaboration
func main() {
guard let identity = CBIdentity(name: "_www", authority: .default()) else { return }
print(identity.isHidden) // -> true
guard let identity = CBIdentity(name: "quinn", authority: .default()) else { return }
print(identity.isHidden) // -> false
}
main()
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"