Re: Root User
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
References: | |
| >Root User (From: Luther Fuller <email@hidden>) |
| >Re: Root User (From: Luther Fuller <email@hidden>) |