[netatalk-admins] Netatalk users (nu PERL script)


Subject: [netatalk-admins] Netatalk users (nu PERL script)
From: Erik Ohlin (eohlin@pacificcolor.com)
Date: Tue Mar 02 1999 - 11:47:47 EST


Does anyone know of any way to report the IP address or MAC (IEEE) address of the users logged into afpd? I didn't see any options in ps that returned this info. Would it be possible to grep that from the syslog?

Here is the nu PERL script we use to return the username, but I need more info since we use the same 'macuser' account on multiple machines.

# nu - by Anders Brownworth anders@thehamptons.com
# modified by Ambrose Li <acli@mail.mingpaoxpress.com>
#
# shows netatalk users logged on
#
# usage: nu

open(USERS, "-|") || exec("/bin/ps", "anucx");

while (<USERS>) {
   push(@users, $1) if /^\s*(\d+)\s.*\bafpd\b/;
}

close USERS;

print "Netatalk users:\n---------------\n";

foreach $user (@users)
{
  if ($user) { # not root
    ($name,$_,$_,$_,$_,$_,$gcos) = getpwuid($user);
    print(defined $gcos && $gcos =~ /^([^,]+)/? $1: $name, "\n");
  }
}

---
<------------------------------------------------------------->
| Erik Ohlin   mailto:eohlin@pacificcolor.com   (760)438-8933 |
| Pacific Color http://www.pacificcolor.com fax:(760)438-8414 |
|    1916 Palomar Oaks Way, Suite 100, Carlsbad, CA  92008    |
<------------------------------------------------------------->



This archive was generated by hypermail 2b28 : Sat Dec 18 1999 - 16:16:22 EST