# /var/run - permission to write for other users ?

## gent00-fun

I have upgraded mysql (to 5.5.29-r1 version), but couldn't start *Quote:*   

> Can't start server : Bind on unix socket: Permission denied

 

Problem was with permission on /var/run (only root can write here), mysql user can't create /var/run/mysql/mysqld.sock file.

mysql is started as mysql user but mysql can't write to /var/run.

i solved this by changed /etc/mysql/my.cnf as below, but i wonder about /var/run directory...

```
socket                                          = /var/lib/mysql/mysqld.sock

pid-file                                        = /var/lib/mysql/mysqld.pid
```

maybe can i change permissions to /var/run directory to allow other users than root write here. is this good idea ??

----------

## Hu

No, leave the permissions as-is.  Directories in /var/run need to be created by the initscript if the program is not run as root, since modern /var/run tends to get cleared at reboot.

----------

## gent00-fun

The same problem with screen command now.

 *Quote:*   

> Cannot make directory '/var/run/screen': Permission denied

 

I made big update (emerge --update --ask world) and after that have problems with permissions.

I see that /var/run is link to /run now (i think that was not previously)

```

$ ls /var/run 

lrwxrwxrwx 1 root root 4 Feb 23 07:59 /var/run -> /run
```

What can i do to solve problems with permissions ??

----------

## khayyam

gent00-fun ...

tempfiles.d ... openrc-0.11.x introduced a reimplementation of systemd's tmpfiles.d (/etc/init.d/tmpfiles.setup and /lib/rc/sh/tmpfiles.sh) and should be 100% compatable with the above linked manpage.

best ... khay

----------

## gent00-fun

Hmm...

Where are default config files?

I have no files at:

 *Quote:*   

> /etc/tmpfiles.d/*.conf
> 
> /run/tmpfiles.d/*.conf
> 
> /usr/lib/tmpfiles.d/*.conf

 

For mysql i've created /etc/tmpfiles.d/mysqld.conf like below. I hope that is ok.

```
d       /var/run/mysql              0755 mysql mysql - -

f       /var/run/mysql/mysqld.sock  0755 mysql mysql - -
```

----------

## khayyam

 *gent00-fun wrote:*   

> Where are default config files?

 

gent00-fun ... there are no default config files. I assume the reason for this is that these should be part of the package in question, and not part of openrc, which just provides the mechanism to handle them. However, if one looks at /lib/rc/sh/tmpfiles.sh the following is defined:

```
tmpfiles_dirs='/usr/lib/tmpfiles.d/ /etc/tmpfiles.d/ /run/tmpfiles.d/'
```

... so the method should be the same as described in the systemd implimentation manpage.

 *gent00-fun wrote:*   

> For mysql i've created /etc/tmpfiles.d/mysqld.conf like below. I hope that is ok.
> 
> ```
> d       /var/run/mysql              0755 mysql mysql - -
> 
> ...

 

That looks ok, but you should use /run, rather than /var/run (the latter is just a sym-link to /run and will no doubt be migrated in future). I haven't needed anything myself as I'm not using anything the breaks due to /var/run now being tmpfs ... so I haven't spent anytime reading the various docs. I'm just presenting what I understand to be the current method of dealing with the issue.

best ... khay

----------

