How to find MAC address and uids?

James Weatherley news at weatherley.net
Wed Nov 10 10:16:04 EST 2004


In article <postmaster-718ADE.06591510112004 at news1.east.earthlink.net>, 
postmaster at earthlink.net says...
> I'm writing a script for work and to finnish it, I need two bits of 
> information which I'm having trouble finding.
> 
> 1) How can I programatically find the MAC address of the machine? Is it 
> stored in a file I can look into? (MacOS X)

$ ifconfig | grep ether | awk {'print $2'}
Note that there may be 0, 1 or many MAC addresses.

> 2) If I have a user name in a string how do I get his UID?

This gets the uid for 'james':
$ nireport . /users name uid | grep james | awk '{print $2}'



More information about the Python-list mailing list