I've tried to set a symlink from

/tmp/mysql.sock -> /var/run/mysqld/mysqld.sock

however whenever I try to do it using the following command:

sudo ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

I get the following response:

ln: failed to access ‘/tmp/mysql.sock’: Permission denied

I've attempted to use chmod but same response.

I need to do this because of an issue with HHVM https://github.com/facebook/hhvm/issues/4987

(I'm running Ubuntu 14.04LTS)


It sounds like the /tmp folder has the sticky bits set

This means your permission is denied due to protected_symlinks

When protected_symlinks is set to "0", the symlink following behaviour is unrestricted.

When set to "1" symlinks are permitted to be followed only when outside a sticky world-writable directory, or when the uid of the symlink and follower match, or when the directory owner matches the symlink's owner.

To change this behaviour

sysctl -w fs.protected_symlinks=0

Further reading Permissions

  • Ah thanks, that sorted it for me. I had to rename /tmp/mysql.sock and then create the symlink to the old name. – Matt Mar 22 '15 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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