Re: Owner/User Name in OSX
Re: Owner/User Name in OSX
- Subject: Re: Owner/User Name in OSX
- From: John W Baxter <email@hidden>
- Date: Fri, 26 Apr 2002 09:24:12 -0700
At 17:54 +0800 4/26/2002, bill wrote:
>
Well, if the current user is not the owner, it9s quite difficult to find out
>
the long name of the owner, or other users.
It's quite easy (except for positively identifying the owner...unless one
has been messing around, the owner has UID 501), if one goes beyond
Applescript...here I used a small Perl script:
[localhost:/tmp] ....% cat /tmp/n.pl
#!/usr/bin/perl -w
while (@e = getpwent) {
print "$e[0] $e[2] $e[6]\n";
}
Now...
do shell script "/tmp/n.pl"
gives you a string with a user per line (UID order, except for good old
nobody and her sometimes-negative UID):
"nobody 4294967294 Unprivileged User
root 0 System Administrator
daemon 1 System Services
unknown 99 Unknown User
www 70 World Wide Web Server
.... 501 John Baxter
.... 502 John W. Baxter
.... 503 John W Baxter
.... 504 Mail test"
Only the first of my users has an "easy" relationship between the short and
the long name, and none has the default suggested by Apple's code.
--John (who would actually write Python code, but Python doesn't come
with Mac OS X)
--
John Baxter email@hidden Port Ludlow, WA, USA
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.