>Is there any way to find the pid of the process that owns a particular
>UNIX socket? lsof, fuser, and netstat all have that functionality, but
>all require root privileges, if the process is owned by another user,
>even if my user has read/write acess on the socket itself. There is
>always the setuid option of one of these files, but I don't want to do
>that. Any ideas?
Casey:
All of the above mentioned utilities work by doing an equivalent of ls -l
(opendir()/readdir()/stat()) on the /proc/<pid>/fd directories. The permissions
on /proc/<pid>/fd are 500, with the ownership of the process user and they
cannot be changed with chmod. I would expect that there is no other way to peek
at the open file descriptors of a process, and if there was, for security
reasons you would have to be its owner. Come to think of it, just being able to
read/write to a socket from a UNIX security standpoint should not allow you to
query which process owns it.
I would recommend using sudo and giving your non-root user a special privilege
to run sudo lsof on the file patterns matching all the possible socket paths.
--
Sasha Pachev
AskSasha Linux Consulting
http://www.asksasha.com
--------------------
BYU Unix Users Group
http://uug.byu.edu/
The opinions expressed in this message are the responsibility of their
author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG.
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list