P is for Practical | |
PerlMonks |
Samba, Linux, Winbind, UTMP, usernames and IP addressesby Kickstart (Pilgrim) |
on Jun 12, 2002 at 21:49 UTC ( [id://174029]=CUFP: print w/replies, xml ) | Need Help?? |
We recently needed a way to get the usernames and IP addresses for our users, but in a mixed environment it was a little difficult. We've got no local users on the Linux/Samba machine, everyone authenticates via Winbind to Active Directory on Window 2000. With the inclusion of 'utmp = yes' in smb.conf, the users who are connected to a share (in our case all of them) show up under the 'who' command with an entry like:
<domainname>\<username> smb/116 Jun 12 09:32 (10.0.10.9)
So...because Windows 2000 Active Directory doesn't automatically grab the IP address of logged in users (apparently will do so with the ILS Telephony service installed), a little bit of Perl will allow us to request a specific username based on IP address, an IP address based on a submitted username, or a list of everyone nicely formatted. From there, all sorts of uses come up (in our case, being able to start a VNC connection without doing a IP address lookup automatically is useful).
Here's the script:
Kickstart edited - 17 June 2002 (footpad): Added <READMORE> Tag.
Back to
Cool Uses for Perl
|
|