Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a bit confused as to see that going from one Linux distribution to another, the package managers will sometimes configure processes to create the socket file either in /tmp or in /var/run/%process%, but I'm seeing it as a standard in open source projects that you configure your applications to refer to the socket in /tmp, as if to normalize the two options.

I too have chosen to distribute a project's configuration to refer to the socket in /tmp. Now I'd like to know, for the sake of not overriding the defaults, if I'd like to link a socket from /var/run into /tmp, is there a safe way to do that?

I'm mostly asking this because I wouldn't like somebody to deal with spurious application errors because the /tmp directory got wiped clean and the socket link is no longer there.

share|improve this question
up vote 1 down vote accepted

/tmp is not a "standard"0 anymore for system daemons; the only program in wide use1 that still puts sockets there is Xorg. All other daemons use /run or /var/run for this – precisely to avoid such problems as periodic /tmp cleaning or possible name collisions with user-created sockets.

There is no standard method of cleaning /tmp or excluding files from said cleanup.

0 The Filesystem Hierarchy Standard (FHS) has never defined /tmp for anything else but temporary files.

1 That I know of.

share|improve this answer
I did some quick googling and found that MySQL and MongoDB will put the socket in /tmp by default. These are just small samples, but it goes to show that you can't specify a fixed path to the socket, which is why I'm assuming a lot of applications roll out with configurations that simply point to the socket in /tmp (say for those that expect to work with a MySQL socket). It's a bit of a hairy situation if there really is no safe way to link it! – Filip Dupanović May 5 '12 at 11:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.