<?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>Parolski.com &#187; chdir())</title>
	<atom:link href="http://www.parolski.com/tag/chdir/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.parolski.com</link>
	<description>Faith, Solaris, and Chicken Korma, by Anton Parol</description>
	<lastBuildDate>Mon, 26 Jul 2010 20:34:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>cd needs execute permissions to work?!</title>
		<link>http://www.parolski.com/2008/03/09/cd-needs-execute-permissions-to-work/</link>
		<comments>http://www.parolski.com/2008/03/09/cd-needs-execute-permissions-to-work/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 01:41:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[cd]]></category>
		<category><![CDATA[chdir())]]></category>
		<category><![CDATA[EACCES]]></category>
		<category><![CDATA[man page]]></category>
		<category><![CDATA[stat()]]></category>

		<guid isPermaLink="false">http://www.parolski.com/2008/03/09/cd-needs-execute-permissions-to-work/</guid>
		<description><![CDATA[You need execute permission on a directory to cd to it! Is read not enough? In practice, no. The chdir system call requires execute permission to make that directory the starting point for path searches. According to the chdir (system call, section 2) man page: For a directory to become the current directory, a process [...]]]></description>
			<content:encoded><![CDATA[<p>You need execute permission on a directory to<code> cd </code>to it!  Is read not enough? In practice, no. The <code>chdir </code>system call requires execute permission to make that directory the starting point for path searches. According to the <code>chdir</code> (system call, section 2) man page:<br />
<code><br />
For a directory to become the current directory,  a  process<br />
must have execute (search) access to the directory.</code></p>
<p>So when trussing the output of a failed <code>cd </code>to a directory with no execute permissions we see:</p>
<p><code>chdir("lala")                                   Err#13 EACCES [file_dac_search]<br />
chdir("lala")                                   Err#13 EACCES [file_dac_search]</code></p>
<p>and as the man page goes on to say:<br />
<code><br />
EACCES          Search permission is  denied  for  any  com-<br />
ponent of the path name.</code></p>
<p>Reading <a href="http://www.hccfl.edu/pollock/AUnix1/FilePermissions.htm">this article</a> explains, that of course you can&#8217;t execute a directory but rather, that the execute permission bit is reused for different purposes. Without execute permission on the directory, you can&#8217;t  <code>stat()</code> any files within the directory. Opening, deleting and other operations on a file first require you to<code> stat()</code> it first, as <code>stat()</code> gives you the files inode. Without the files inode, theres very little you can do with it!</p>
<p>Armed with this knowledge you might feel inspired to check out the <a href="http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/syscall/chdir.c">source code</a> of this call for yourself!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.parolski.com/2008/03/09/cd-needs-execute-permissions-to-work/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
