Change Owner of Symlink in Linux

By BXTra |

When you use chown to change ownership of a file or directory, it will work but with Symlink (Created by using ln command), you can't do that. When you do it, it will fail and you may not know that since there is no error message or anything to let you know. So, to change ownership for Symlink, you need to use option -h. Below is an example :

chown -h user:group symlink

Be careful when you use it with directory. Not to have trailing slash (/) at the end or it won't work. So, if you have a Symlink directory name munin What you have to do is :

chown -h root:root /var/www/munin

not

chown -h root:root /var/www/munin/

Add new comment

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.