Change Owner of Symlink in Linux

By BXTra | Mon, 07/25/2011 - 21:43

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


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