[GH-ISSUE #1192] config ignored for non-root users, no debug output!? #840

Closed
opened 2026-05-07 00:27:55 +02:00 by BreizhHardware · 4 comments

Originally created by @bobemoe on GitHub (Sep 30, 2024).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1192

🐞 Describe the bug

I have set /etc/ntfy/client.yml with a custom default-host and default-token and when i run as root ntfy pub test test it works just fine!

The issue is when I run as a normal user it seems to be ignoring /etc/ntfy/client.yml and publishing to ntfy.sh rather than my custom server.

I have confirmed my normal user can read /etc/ntfy/client.yml and that no ~/.config/ntfy/client.yml or ENV vars are overriding the config.

Additionally I try to debug with --debug and --trace but these add no extra output.

It works if I:

mkdir ~/.config/ntfy
cp /etc/ntfy/client.yml ~/.config/ntfy/

But I dont want to have to do that for all users :/

💻 Components impacted

Devuan Linux, server running in docker and client using static binaries.
ntfy 2.11.0 (d11b100), runtime go1.22.2, built at 2024-05-13T20:16:12Z

💡 Screenshots and/or logs

$ ntfy --debug --trace pub test test
{"id":"ABga54IscnkW","time":1727711598,"expires":1727754798,"event":"message","topic":"test","message":"test"}

🔮 Additional context

services:
  ntfy:
    image: binwiederhier/ntfy
    restart: unless-stopped
    environment:
      NTFY_BASE_URL: http://ntfy.xxxx.co.uk
      NTFY_CACHE_FILE: /var/lib/ntfy/cache.db
      NTFY_AUTH_FILE: /var/lib/ntfy/auth.db
      NTFY_AUTH_DEFAULT_ACCESS: deny-all
      NTFY_BEHIND_PROXY: true
      NTFY_ATTACHMENT_CACHE_DIR: /var/lib/ntfy/attachments
      NTFY_ENABLE_LOGIN: true
    volumes:
      - ./data/:/var/lib/ntfy
    ports:
      - 9753:80
    command: serve

Originally created by @bobemoe on GitHub (Sep 30, 2024). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1192 :lady_beetle: **Describe the bug** <!-- A clear and concise description of the problem. --> I have set `/etc/ntfy/client.yml` with a custom `default-host` and `default-token` and when i run as root `ntfy pub test test` it works just fine! The issue is when I run as a normal user it seems to be ignoring `/etc/ntfy/client.yml` and publishing to `ntfy.sh` rather than my custom server. I have confirmed my normal user can read `/etc/ntfy/client.yml` and that no `~/.config/ntfy/client.yml` or ENV vars are overriding the config. Additionally I try to debug with --debug and --trace but these add no extra output. It works if I: ``` mkdir ~/.config/ntfy cp /etc/ntfy/client.yml ~/.config/ntfy/ ``` But I dont want to have to do that for all users :/ :computer: **Components impacted** <!-- ntfy server, Android app, iOS app, web app --> Devuan Linux, server running in docker and client using static binaries. ntfy 2.11.0 (d11b100), runtime go1.22.2, built at 2024-05-13T20:16:12Z :bulb: **Screenshots and/or logs** <!-- If applicable, add screenshots or share logs help explain your problem. To get logs from the ... - ntfy server: Enable "log-level: trace" in your server.yml file - Android app: Go to "Settings" -> "Record logs", then eventually "Copy/upload logs" - web app: Press "F12" and find the "Console" window --> ``` $ ntfy --debug --trace pub test test {"id":"ABga54IscnkW","time":1727711598,"expires":1727754798,"event":"message","topic":"test","message":"test"} ``` :crystal_ball: **Additional context** <!-- Add any other context about the problem here. --> ``` services: ntfy: image: binwiederhier/ntfy restart: unless-stopped environment: NTFY_BASE_URL: http://ntfy.xxxx.co.uk NTFY_CACHE_FILE: /var/lib/ntfy/cache.db NTFY_AUTH_FILE: /var/lib/ntfy/auth.db NTFY_AUTH_DEFAULT_ACCESS: deny-all NTFY_BEHIND_PROXY: true NTFY_ATTACHMENT_CACHE_DIR: /var/lib/ntfy/attachments NTFY_ENABLE_LOGIN: true volumes: - ./data/:/var/lib/ntfy ports: - 9753:80 command: serve ```
BreizhHardware 2026-05-07 00:27:55 +02:00
  • closed this issue
  • added the
    🪲 bug
    label
Author
Owner

@wunter8 commented on GitHub (Sep 30, 2024):

It is mentioned briefly in the first paragraph of this section (https://docs.ntfy.sh/subscribe/cli/#install-configure), but the client CLI is only configured to look at /etc/ntfy/client.yml for the root user. When the ntfy client CLI is run as a non-profit user, the CLI looks in ~/.config/ntfy/client.yml.

You can tell the CLI to load a non-default config file by including it as a command line parameter: ntfy pub --config /etc/ntfy/client.yml test test

<!-- gh-comment-id:2383724395 --> @wunter8 commented on GitHub (Sep 30, 2024): It is mentioned briefly in the first paragraph of this section (https://docs.ntfy.sh/subscribe/cli/#install-configure), but the client CLI is only configured to look at `/etc/ntfy/client.yml` for the root user. When the ntfy client CLI is run as a non-profit user, the CLI looks in `~/.config/ntfy/client.yml`. You can tell the CLI to load a non-default config file by including it as a command line parameter: `ntfy pub --config /etc/ntfy/client.yml test test`
Author
Owner

@bobemoe commented on GitHub (Sep 30, 2024):

Ok, I was beginning to think it was expected behaviour. Your --config trick is useful but still a bit of a pain to implement for all users, I liked the idea of the CLI being simpler than curl where I have to include a -H Authorise... line. If I have to include a --config it is adding back a similar complexity.

Its not really the end of the world and I'm happy now I have the hang of it.

Maybe convert this to a feature request for a global "all users" config? Otherwise close as working.

Thanks.

<!-- gh-comment-id:2383746423 --> @bobemoe commented on GitHub (Sep 30, 2024): Ok, I was beginning to think it was expected behaviour. Your --config trick is useful but still a bit of a pain to implement for all users, I liked the idea of the CLI being simpler than curl where I have to include a -H Authorise... line. If I have to include a --config it is adding back a similar complexity. Its not really the end of the world and I'm happy now I have the hang of it. Maybe convert this to a feature request for a global "all users" config? Otherwise close as working. Thanks.
Author
Owner

@wunter8 commented on GitHub (Sep 30, 2024):

It is expected that each user would have their own config (e.g., their own default server, their own default auth credentials, their own subscriptions, their own set of commands to run when a message is received, etc.). That's why, by default, the client CLI looks in the user's config directory.

If you want to easily use the /etc/ntfy/client.yml file, you can sudo ntfy pub test test or you can set up a command alias/function in your terminal to automatically include "--config /etc/ntfy/client.yml" (but I recognize that is also something you'd need to do/configure for each individual user)

<!-- gh-comment-id:2383759093 --> @wunter8 commented on GitHub (Sep 30, 2024): It is expected that each user would have their own config (e.g., their own default server, their own default auth credentials, their own subscriptions, their own set of commands to run when a message is received, etc.). That's why, by default, the client CLI looks in the user's config directory. If you want to easily use the /etc/ntfy/client.yml file, you can `sudo ntfy pub test test` or you can set up a command alias/function in your terminal to automatically include "--config /etc/ntfy/client.yml" (but I recognize that is also something you'd need to do/configure for each individual user)
Author
Owner

@bobemoe commented on GitHub (Oct 1, 2024):

All good suggestions, thanks :)

<!-- gh-comment-id:2385051488 --> @bobemoe commented on GitHub (Oct 1, 2024): All good suggestions, thanks :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#840
No description provided.