class Inspec::Resources::DarwinUser
@see superuser.com/questions/592921/mac-osx-users-vs-dscl-command-to-list-user<br>@see developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dscl.1.html<br>instead we use ‘dscl’ to request user data
@see developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/fingerd.8.html<br>we do not use ‘finger’ for MacOS, because it is harder to parse data with it
def initialize(inspec)
def initialize(inspec) @list_users_cmd ||= 'dscl . list /Users' super end
def meta_info(username)
def meta_info(username) cmd = inspec.command("dscl -q . -read /Users/#{username} NFSHomeDirectory PrimaryGroupID RecordName UniqueID UserShell") return nil if cmd.exit_status != 0 params = SimpleConfig.new( cmd.stdout.chomp, assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/, group_re: nil, multiple_values: false, ).params { home: params['NFSHomeDirectory'], shell: params['UserShell'], } end