Seems like at least OpenBSD implemented SO_PEERCRED which returns a struct

/* Read using getsockopt() with SOL_SOCKET, SO_PEERCRED */
struct sockpeercred {
uid_t uid; /* effective user id */
gid_t gid; /* effective group id */
pid_t pid;

If not anyone is oppose to this or know some other secret API that provides
similar functionality, I can see if I can put together a patch for this
very useful API.

On Sun, Jul 9, 2017 at 10:03 AM, Johannes Lundberg <>

> Hi
> Without altering the client code (i.e. adding sendmsg(credentials)), is
> there anyway of getting the client PID (or path to binary) using the file
> descriptor returned by accept() on the server side?
> Similar to Linux's getsockopt with SO_PEERCRED option.
> Thanks!
_______________________________________________ mailing list
To unsubscribe, send any mail to ""

Reply via email to