Is there a way to get the uid of the other end of a unix socket connection

前端 未结 2 806
挽巷
挽巷 2021-02-06 03:12

Is there a way for a UNIX domain socket listener to only accept connection from certain user (chmod/chown does not work for abstract socket afaik), or

2条回答
  •  死守一世寂寞
    2021-02-06 03:27

    Yes -- this operation, along with FD passing, is supported via an ancilliary message with the SCM_CREDENTIALS type. The calls involved are documented in man 7 unix.

提交回复
热议问题