3 ms·
For many applications it is enough. For others, such as placing a UDS in a user's home directory or temp folder, it may not be. Often times you don't know ahead
by searealist 4y ago
For many applications it is enough. For others, such as placing a UDS in a user's home directory or temp folder, it may not be. Often times you don't know ahead of time what the path may be.
- pabs3 4y agoUnix sockets should definitely not be in any non-tmpfs filesystem, subdirectories of /run are the sole place they should be.
- searealist 4y agoCare to justify your advice?
- pabs3 4y agoThey are ephemeral, they hold no data after being closed and backups of them aren't useful. Only the name is needed, therefore a tmpfs is the place to store them.
- zbentley 4y agoThe name of the socket file/the fact that it exists contains data. As a result, it's useful to keep them in non-tmpfs paths that can survive a reboot. That way, very simple programs can use them as sort of a config file: `$XDG_HOME/myprogram/do_xyz.sock`. Additionally, persistent sockets created once at program install time can help coordinate multiple launches of whatever uses them (e.g. by having servers flock(2) the socket or fight over binding to it as a mutex). For programs whose "server" component isn't managed by a service manager, but can instead be launched many times in response to some user action, that can simplify things.
- searealist 4y agoAnd if I want to run a daemon as a user where should the socket go?
- pabs3 4y agoFor example the OpenSSH agent uses this path: /run/user/$UID/openssh_agent Several things place sockets there, some other stuff places the socket in a subdirectory.