• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Root User
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Root User


  • Subject: Re: Root User
  • From: Luther Fuller <email@hidden>
  • Date: Thu, 27 Mar 2014 11:16:48 -0500

On Mar 27, 2014, at 9:48 AM, Philip Stokes wrote:

(do shell script "/usr/bin/id -u") = “501”

This seems to work, but I can't verify the meaning of "501" despite much time trying to Google this.

On Mar 27, 2014, at 10:41 AM, koenig.yvan wrote:

do shell script "whoami"
do shell script "id " & result
--> "uid=201(Guest) gid=201(_guest) groups=201(_guest),12(everyone),61(localaccounts),402(com.apple.sharepoint.group.1),100(_lpoperator)"
set isAdmin to result contains "80(admin)"
--> false

This, or variations on this theme, seems to work.
For example, I found this, while Googling, ...

on amIAdmin()
set prevDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to " "
set groups to do shell script "id -G -n"
set groupList to text items of groups
set isAdmin to "admin" is in groupList
set AppleScript's text item delimiters to prevDelims
return isAdmin
end amIAdmin

I am still a little surprised that SE or Finder don't contain a simple command to do this.



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Root User
      • From: Axel Luttgens <email@hidden>
References: 
 >Root User (From: Luther Fuller <email@hidden>)
 >Re: Root User (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Root User
  • Next by Date: Re: Root User
  • Previous by thread: Re: Root User
  • Next by thread: Re: Root User
  • Index(es):
    • Date
    • Thread