use strict; use warnings; use IO::Socket; use IO::Handle::Record; $| = 1; unlink('/tmp/catsock'); my $server = new IO::Socket::UNIX( Type => SOCK_STREAM, Local => '/tmp/catsock', Listen => SOMAXCONN ); die "Coudn't open socket" unless $server; my $client; my $count = 0; while(1) { $client = $server->accept(); my ($pid, $uid, $gid) = $client->peercred; # name, pass, uid, gid, quota, comment, gcos, dir, shell, expire my @uinfo = getpwuid($uid); print "$count. Credentials User: $uinfo[0] PID: $pid UID: $uid GID: $gid\n" . <$client> . "\n"; $count++; }