debian12使用ntp时查看有个错误:statistics directory /var/log/ntpsec/ does not exist or is unwriteable, error Permission denied

debian12在使用systemctl status ntpd时发现出现个权限错误

root@debian:~# systemctl status ntpd
● ntpsec.service - Network Time Service
     Loaded: loaded (/lib/systemd/system/ntpsec.service; enabled; preset: enabled)
     Active: active (running) since Fri 2024-05-24 10:25:43 CST; 16s ago
       Docs: man:ntpd(8)
    Process: 3425 ExecStart=/usr/libexec/ntpsec/ntp-systemd-wrapper (code=exited, status=0/SUCCESS)
   Main PID: 3429 (ntpd)
      Tasks: 1 (limit: 2265)
     Memory: 10.5M
        CPU: 77ms
     CGroup: /system.slice/ntpsec.service
             └─3429 /usr/sbin/ntpd -p /run/ntpd.pid -c /etc/ntpsec/ntp.conf -g -N -u ntpsec:ntpsec

May 24 10:25:43 debian ntpd[3429]: IO: Listening on routing socket on fd #22 for interface updates
May 24 10:25:43 debian ntpd[3429]: INIT: MRU 10922 entries, 13 hash bits, 65536 bytes
May 24 10:25:43 debian ntpd[3429]: INIT: Built with OpenSSL 3.0.9 30 May 2023, 30000090
May 24 10:25:43 debian ntpd[3429]: INIT: Running with OpenSSL 3.0.11 19 Sep 2023, 300000b0
May 24 10:25:43 debian ntpd[3429]: NTSc: Using system default root certificates.
May 24 10:25:43 debian ntpd[3429]: statistics directory /var/log/ntpsec/ does not exist or is unwriteable, error Permission denied
May 24 10:25:44 debian ntpd[3429]: DNS: dns_probe: ntp.aliyun.com, cast_flags:1, flags:20801
May 24 10:25:44 debian ntpd[3429]: DNS: dns_check: processing ntp.aliyun.com, 1, 20801
May 24 10:25:44 debian ntpd[3429]: DNS: Server taking: 203.107.6.88
May 24 10:25:44 debian ntpd[3429]: DNS: dns_take_status: ntp.aliyun.com=>good, 0

出现个错误

statistics directory /var/log/ntpsec/ does not exist or is unwriteable, error Permission denied

然后使用命令查看一下运行端口和权限:

root@debian:~# lsof -i -P -n

运行账号是ntpsec,会不会是因为那个目录没有权限呢,这时去查看,发现没有/var/log/ntpsec/ 这个目录,然后我们手工创建一个ntpsec目录,并且加上权限

root@debian:~# mkdir /var/log/ntpsec/
root@debian:~# chown ntpsec:ntpsec /var/log/ntpsec/

然后重启ntpd服务

root@debian:~# systemctl restart ntpd

再次查看就没有报错了

 

 收藏 (0) 打赏

您可以选择一种方式赞助本站

支付宝扫一扫赞助

微信钱包扫描赞助

未经允许不得转载:番茄网 » debian12使用ntp时查看有个错误:statistics directory /var/log/ntpsec/ does not exist or is unwriteable, error Permission denied

分享到: 生成海报

热门文章

  • 评论 抢沙发

    • QQ号
    • 昵称 (必填)
    • 邮箱 (必填)
    • 网址

    像番茄一样 表里如一

    表里如一表里如一
    切换注册

    登录

    忘记密码 ?

    切换登录

    注册

    我们将发送一封验证邮件至你的邮箱, 请正确填写以完成账号注册和激活