Bug 207807

Summary: mountd: mountd.pid file is not readable by normal users
Product: Base System Reporter: Ruben Kerkhof <ruben>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Not A Bug    
Severity: Affects Some People CC: asomers, jilles
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Change permissions of mountd.pid to 0644 none

Description Ruben Kerkhof 2016-03-08 14:34:55 UTC
I have a daemon running as a normal user, that runs /etc/rc.d/mountd status once in a while to check if mountd is running. /var/run/mountd.pid is only readable by root however:

% ls -l /var/run/mountd.pid 
-rw-------  1 root  wheel  5 Mar  8 14:33 /var/run/mountd.pid


It's not that it contains secret information ;)
Can those permissions please be changed?
Comment 1 Ruben Kerkhof 2016-03-08 14:42:15 UTC
Created attachment 167853 [details]
Change permissions of mountd.pid to 0644
Comment 2 Jilles Tjoelker freebsd_committer freebsd_triage 2016-03-09 19:35:44 UTC
Unfortunately, mountd uses pidfile(3) which relies on file locking and making the file world-readable would allow any user to lock it in shared mode, possibly disturbing the scheme.
Comment 3 Ruben Kerkhof 2016-03-10 09:39:15 UTC
Thanks for the explanation Jilles.

Interestingly enough dhclient and nscd also set the permissions on their pidfiles to 644.
Comment 4 Alan Somers freebsd_committer freebsd_triage 2021-04-19 02:14:52 UTC
Closing as not-a-bug, according to Jilles' explanation.