<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Eclecti.ca &#187; How To</title>
	<atom:link href="http://eclecti.ca/category/how-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://eclecti.ca</link>
	<description>A collection of the various, sundry and diverse by Sean Yo</description>
	<lastBuildDate>Thu, 29 Jul 2010 15:00:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Changing Symlink Ownership</title>
		<link>http://eclecti.ca/2009/07/changing-symlink-ownership/</link>
		<comments>http://eclecti.ca/2009/07/changing-symlink-ownership/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 17:09:55 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sysadmin]]></category>

		<guid isPermaLink="false">http://eclecti.ca/?p=89</guid>
		<description><![CDATA[I just encountered the Curious Case of  changing the ownership of a symbolic link.  I used chown and then&#8230;what happened is&#8230;well nothing.  Or least that&#8217;s how it looked.  There was no error message and the symlink&#8217;s ownership was unchanged.
This seemed sub-optimal so I asked Google and a few colleagues and I got the answer, [...]]]></description>
			<content:encoded><![CDATA[<p>I just encountered the Curious Case of  changing the ownership of a symbolic link.  I used chown and then&#8230;what happened is&#8230;well nothing.  Or least that&#8217;s how it looked.  There was no error message and the symlink&#8217;s ownership was unchanged.</p>
<p>This seemed sub-optimal so I asked Google and a few colleagues and I got the answer, more than once, that you can&#8217;t change the ownership of a symlink.  I accepted this and so I deleted the symlink and then I su&#8217;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.</p>
<p>A few minutes later I couldn&#8217;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&#8217;t see that it happened.</p>
<p>Luckily, there is a Good Thing as well, and it&#8217;s chown.  Chown has an option (-h) to reference a symlink itself and not its referenced file:</p>
<p><code>chown --no-dereference user:group symlink</code></p>
<p>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 &gt;:).</p>
<p>Many thanks to the <a title="Edmonds Commerce Blog" href="http://www.edmondscommerce.co.uk/blog/" target="_blank">Edmonds Commerce Blog</a>, a Freelance PHP Ecommerce and SEO Developer in the UK for <a title="Linux Symlink chown" href="http://www.edmondscommerce.co.uk/blog/linux/linux-symlink-chown/" target="_blank">their post explaining this</a>.  Although, if I had just man&#8217;ed chown, I would have been able to figure this out on my own &lt;grin&gt;.</p>
<p><em>update: The man page for chown has a comment that makes it sound like some OS really can&#8217;t change the ownership of a symlink. </em></p>
<p><em>&#8220;</em>-h, &#8211;no-dereference<br />
affect  each symbolic link instead of any referenced file (<strong>useful only on systems that can change the ownership  of a symlink</strong>)&#8221;</p>
<p><em>Just thought I&#8217;d mention that as well.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://eclecti.ca/2009/07/changing-symlink-ownership/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
