This question possibly has relevance in both Unix & Linux and Stack Overflow; I'm posting at Unix & Linux first, because I think I'd like to understand the issue from the perspective of Unix/Linux convention, before any specific technical implementation.

I'm writing a standalone hello-world application that has need to read a configuration file, config.yml.
I've been advised that convention is to install the file at /etc/hello-world/config.yml.
Now, I noticed that /etc/ has write-privilege by root-only:

$ ls -ld /etc
drwxr-xr-x 127 root root 12288 Feb 14 21:16 /etc

I did not set up this Linux PC, but a competent Linux admin did, so I assume this is standard/convention to have /etc/ writable only by user root and readable by everyone else.

So my question is: how can the install mechanism of my hello-world application (cmake && make install) install anything in /etc/ if the processes are being run by a non-root user?

In terms of implementation, my "install mechanism" is an install statement in my CMakeLists.txt, e.g.:

install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.yml
  DESTINATION /etc/hello-world/config.yml)

...but again, since I will be running make install as non-root, this will fail.

Again, I'm asking the question from the perspective of learning Unix/Linux convention -- I imagine this is a common scenario: a lone developer wants to install his config files to "standard" locations, which I was advised is /etc/your-app/your-config. So how does he go about doing so if /etc/ is writable only by root?

Is it understood that make install should only be done by root, or a sudo-privileged user, e.g. sudo make install?
Or is it not correct that config-files should be installed to (a subdirectory of) /etc/?
Or should /etc/'s permissions allow writing by "others"?

1 Answer 1


You can't, by design.

Your app should store per-user configs somewhere in the user's home directory, e.g. ~/.config/your_app/config.yml

System-level configuration files are what belong in /etc/. Like if your app had a local server somewhere on the network that all users should connect to. That file would be installed by the System Admin along with the application.

See also FHS and LSB.

  • My hello-world application would run as a service that ran a web server, therefore would be serving connecting clients...so in that case, would its config files meet what you call "system-level" config file? If yes, then it sounds like convention is that a System Admin would install the config-file and/or the application itself -- is that correct?
    – StoneThrow
    Feb 24, 2023 at 21:47
  • is it an application or a service?
    – Jasen
    Feb 25, 2023 at 6:54
  • 1
    "application would run as a service that ran a web server" that's nowhere in your original question. If it's going to be on standard web server ports (80, 443) then again (by design) you must do this as root. Feb 26, 2023 at 15:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .