ntpq: write to localhost failed: Permission denied

Hi all, dns2 is my FreeBSD backup DNS box, and today I discovered that there may be a problem on my LAN with the time sync from the NTP server on the edge router, so I went to check and force sync each machine on the LAN and got this error on this particular one:

Code:
zq@dns2:~ % sudo ntpq -pn
Password:
ntpq: write to localhost failed: Permission denied
use0@dns2:~ % ntpq 127.0.0.1
ntpq> pe
ntpq: write to 127.0.0.1 failed: Permission denied
ntpq> ^D
use0@dns2:~ % su -
Password:
root@dns2:~ # ntpq -pn
ntpq: write to localhost failed: Permission denied

I've never seen this error and found little to no information about it on Google, so looking for the knowledgeable community's help.
 
zg123
No need for sudo or su for this command

%> ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
0.freebsd.pool. .POOL. 16 p - 64 0 0.000 +0.000 0.000
2.freebsd.pool. .POOL. 16 p - 64 0 0.000 +0.000 0.000
*79.143.250.33 .GPS. 1 u 6 64 377 14.817 +0.240 0.169
-86.225.239.215 145.238.80.80 2 u 56 64 377 18.628 -1.309 0.696
+51.210.178.126 193.62.22.82 2 u 57 64 377 14.511 +0.116 0.253
+31.58.102.164 17.253.108.125 2 u 20 64 377 10.582 +0.079 0.106
 
Is ntpd running on this machine? Though you should get connection refused error in that case.
Run “which ntpq” to see what you are running. Also report uname -a output. And output of “ls -l $(which ntpq)”.
 
Sorry, got a little confused with the ntpd.

# service ntpd status
ntpd is not running.
# service ntpd start
ntpd already running? (pid=17592).
# service ntpd restart
Stopping ntpd.
Waiting for PIDS: 17592.
Starting ntpd.
# service ntpd status
ntpd is running as pid 10449.
# ntpq -pn
ntpq: write to localhost failed: Permission denied

As far as the firewall is concerned, it seems to be configured correctly:

udp_clients = "{ domain, ntp }"
pass out quick proto udp to 10.0.0.1 port $udp_clients keep state
 
# service ntpd status
ntpd is running as pid 10449.
# ntpq -pn
ntpq: write to localhost failed: Permission denied

As far as the firewall is concerned, it seems to be configured correctly:

udp_clients = "{ domain, ntp }"
pass out quick proto udp to 10.0.0.1 port $udp_clients keep state
Does "/usr/bin/ntpq -pn" work? What does the output of "grep -v ^# /etc/ntp.conf | uniq " look like? Which freebsd version (uname -a)? Are you running standard ntpd or from ports?
 
Back
Top