1

Is there a command i can run from terminal that will show what type of accounts are used

something that reports the username and type of account like below

/Users/fred - mobile, standard
/Users/wilma - network admin

3 Answers 3

1

Try this command. It should display what you want.

/usr/bin/dscl . -read /Users/username | 
    egrep 'NFSHomeDirectory|RecordType' | tr '\n' ':' | cut -d':' -f2,5
/Users/username:Users
2
  • 1
    How can the account type be determined from the output of id?
    – nohillside
    Commented Nov 12, 2014 at 12:36
  • I updated my answer, I think I misunderstood the question with my previous answer.
    – jherran
    Commented Nov 12, 2014 at 13:29
1

Start with:

users

then:

id -Gn XXusernameXX | grep 'admin'

If you have an output, then 'XXusernameXX' is an admin account

1
  • You need to place each group on its own line. Maybe something like this- id -Gn XXusernameXX | tr ' ' '\n' | grep -e '^admin'
    – fd0
    Commented Aug 23, 2023 at 14:54
0

There's a simple command/utility called dsmemberutil that will check the group membership of a user. Below is an example of command usage and the output of a user is a member of the group in question (admin)

dsmemberutil checkmembership -U username -G admin

user is a member of the group.     <------------------ Output result

It will also return an exit value of 0 if successful or a 1 if not meaning you can use it within if/then or [[ ]] evaluations in Bash/Zsh.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .