There seems to be a bug in our fstat() implementation when called on a socket. The st_uid member always seems to be 0. NetBSD seems to have a similar problem see https://gnu.emacs.bug.narkive.com/cAVl8Cff/bug-43002-27-1-emacsclient-does-not-like-owner-of-socket-on-netbsd --- emacs-28.1/lib-src/emacsclient.c.orig 2022-03-11 08:04:21.000000000 +0000 +++ emacs-28.1/lib-src/emacsclient.c 2022-04-05 10:48:23.309671173 +0000 @@ -1168,7 +1168,7 @@ struct stat st; if (fstat (dirfd, &st) != 0) return errno; - if (st.st_uid != uid || (st.st_mode & (S_IWGRP | S_IWOTH))) + if (st.st_uid != uid || (st.st_uid == (uid_t)0) || (st.st_mode & (S_IWGRP | S_IWOTH))) return -1; if (wdfd == -1)