Warning: include_once(/home/resonantstudios/gratis/eclecti.ca/public/wordpress/wp-content/plugins/wordpress-support/wordpress-support.php): failed to open stream: Permission denied in /home/resonantstudios/gratis/eclecti.ca/public/wordpress/wp-settings.php on line 221

Warning: include_once(): Failed opening '/home/resonantstudios/gratis/eclecti.ca/public/wordpress/wp-content/plugins/wordpress-support/wordpress-support.php' for inclusion (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/resonantstudios/gratis/eclecti.ca/public/wordpress/wp-settings.php on line 221

Warning: Cannot modify header information - headers already sent by (output started at /home/resonantstudios/gratis/eclecti.ca/public/wordpress/wp-settings.php:221) in /home/resonantstudios/gratis/eclecti.ca/public/wordpress/wp-includes/feed-rss2.php on line 8
Eclecti.ca » How To http://eclecti.ca Like The Internet...but smaller Thu, 08 May 2014 18:30:58 +0000 en-US hourly 1 http://wordpress.org/?v=3.9 Changing Symlink Ownership http://eclecti.ca/changing-symlink-ownership/ http://eclecti.ca/changing-symlink-ownership/#comments Wed, 08 Jul 2009 17:09:55 +0000 http://eclecti.ca/?p=89 I just encountered the Curious Case of changing the ownership of a symbolic link.  I used chown and then…what happened is…well nothing.  Or least that’s how it looked.  There was no error message and the symlink’s ownership was unchanged.

This seemed sub-optimal so I asked Google and a few colleagues and I got the answer, more than once, that you can’t change the ownership of a symlink.  I accepted this and so I deleted the symlink and then I su’ed to the account I wanted to give ownership to and recreated the symlink as that acccount.  Not a Bad Thing, but not a Good Thing either.

A few minutes later I couldn’t stop thinking about how little sense this made.  So I went back to Google and sweet talked her into giving over the goods.  It turns out that what happened the first time I tried to chown the symlink is that chown respected the symlink and I changed the ownership of the referent directory, not the link to it.  That was a Bad Thing.  Especially since I didn’t see that it happened.

Luckily, there is a Good Thing as well, and it’s chown.  Chown has an option (-h) to reference a symlink itself and not its referenced file:

chown --no-dereference user:group symlink

From the Good Thing comes a Happy Ending: I have restored the ownership of the referent directory and successfully changed the ownership of the symlink.  Not to mentioned learned a cool bit of linux trivia.  This would be a terribe(ly awesome) interview questions >:).

Many thanks to the Edmonds Commerce Blog, a Freelance PHP Ecommerce and SEO Developer in the UK for their post explaining this.  Although, if I had just man’ed chown, I would have been able to figure this out on my own <grin>.

update: The man page for chown has a comment that makes it sound like some OS really can’t change the ownership of a symlink.

-h, –no-dereference
affect  each symbolic link instead of any referenced file (useful only on systems that can change the ownership of a symlink)”

Just thought I’d mention that as well.

http://eclecti.ca/changing-symlink-ownership/feed/ 0