I wrote a couple daemons communicating over Unix domain sockets (raw sockets) and now I want to find the most suitable location for them on the production server. Where to put which files?
Here's what I got so far (feel free to suggest better locations):
/usr/sbin/<subdir>/
? /usr/bin/<subdir>/
? Somewhere else?/var/run/<subdir>/
(no idea why but I wouldn't feel comfortable with /tmp/
)/var/log/<subdir>/
/etc/<subdir>/
The target OS is Ubuntu server 16.04+.
There are many fine resources on the standards, including https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html
I would suggest:
/run/<subdir>/
. That's because /var/run
is just a sym-link to /run
these days on Ubuntu. /run
is the newer standard place for such things./var/log/<subdir>/
Correct. Although a single log doesn't actually need a directory. Don't forget to add an /etc/logrotate.d
entry as well/etc/<subdir>/
Correct. Again a single config file doesn't need a directory but it doesn't hurt.The binaries:
These are tricky; there's a whole bunch of places they can exist. Generally bin
is for user commands, sbin is for server daemons. Some people say sbin
is for binaries executed only by root. See here: https://askubuntu.com/questions/308045/differences-between-bin-sbin-usr-bin-usr-sbin-usr-local-bin-usr-local
/bin
or /sbin
. Reserve these for binaries required to boot your system./usr/bin
and /usr/sbin
. Most things on unbuntu live here although there are exceptions. If you are properly packaging your software (into a .dpkg or similar) then definitely use /usr/bin
and /usr/sbin
./usr/local/bin
and /usr/local/sbin
are more appropriate. But this generally shouldn't be used if you are going to distribute your code to other people./usr/lib
or /usr/local/lib
. It's not uncommon for binaries to be thought of as librariesIn short, /usr/sbin
and /usr/bin
are most likely correct.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments