<?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>Bryan Geraghty &#187; Linux</title>
	<atom:link href="http://bryan.ravensight.org/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://bryan.ravensight.org</link>
	<description>Music, Photography, Security, and Programming</description>
	<lastBuildDate>Sat, 06 Aug 2011 21:18:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>How To Clear Memory Cache In Linux (&gt;= 2.6.16)</title>
		<link>http://bryan.ravensight.org/2010/12/how-to-clear-memory-cache-in-linux-2-6-16/</link>
		<comments>http://bryan.ravensight.org/2010/12/how-to-clear-memory-cache-in-linux-2-6-16/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 18:23:33 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Memory]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://bryan.ravensight.org/?p=271</guid>
		<description><![CDATA[Without getting into the politics of why you would want to clear your memory cache in Linux, here is a very small script I wrote to do just that. It makes use of a feature that was introduced in kernel 2.6.16, so your kernel version needs to be >= 2.6.16 in order to use this [...]]]></description>
			<content:encoded><![CDATA[<p>Without getting into the politics of why you would want to clear your memory cache in Linux, here is a very small script I wrote to do just that. It makes use of a feature that was introduced in kernel 2.6.16, so your kernel version needs to be  >= 2.6.16 in order to use this script. If you&#8217;re running a kernel older than that, you have bigger problems to worry about than your memory cache ;) If you don&#8217;t know how to determine your kernel version, you&#8217;re probably better off not messing with your memory cache.</p>
<p>free-cache:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;">###</span>
<span style="color: #666666; font-style: italic;"># This script flushes the file system buffers and clears memory caches.</span>
<span style="color: #666666; font-style: italic;"># </span>
<span style="color: #666666; font-style: italic;"># From the man page:</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># /proc/sys/vm/drop_caches (since Linux 2.6.16)</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#   Writing to this file causes the kernel to drop clean caches, dentries and</span>
<span style="color: #666666; font-style: italic;">#   inodes from memory, causing that memory to become free.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#   To free pagecache, use echo 1 &gt; /proc/sys/vm/drop_caches</span>
<span style="color: #666666; font-style: italic;">#   To free dentries and inodes, use echo 2 &gt; /proc/sys/vm/drop_caches</span>
<span style="color: #666666; font-style: italic;">#   To free pagecache, dentries and inodes, use echo 3 &gt; /proc/sys/vm/drop_caches</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># @Author Bryan C. Geraghty &lt;bryan@ravensight.org&gt;</span>
<span style="color: #666666; font-style: italic;"># @Since 2010-11-01</span>
<span style="color: #666666; font-style: italic;">##</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">sync</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">'echo 3 &gt; /proc/sys/vm/drop_caches'</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://bryan.ravensight.org/2010/12/how-to-clear-memory-cache-in-linux-2-6-16/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux ACL Management Functions</title>
		<link>http://bryan.ravensight.org/2010/01/linux-acl-management-functions/</link>
		<comments>http://bryan.ravensight.org/2010/01/linux-acl-management-functions/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 22:07:32 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[ACL]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Permissions]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://bryan.ravensight.org/?p=164</guid>
		<description><![CDATA[Traditional file system permissions management in Linux leaves most users wanting. Fortunately, there&#8217;s a feature that most linux users don&#8217;t even know about called ACLs and it&#8217;s most likely already available on your system. All you have to do to enable it is add the `acl` option to your volume in `/etc/fstab` and re-mount the [...]]]></description>
			<content:encoded><![CDATA[<p>Traditional file system permissions management in Linux leaves most users wanting. Fortunately, there&#8217;s a feature that most linux users don&#8217;t even know about called ACLs and it&#8217;s most likely already available on your system. All you have to do to enable it is add the `acl` option to your volume in `/etc/fstab` and re-mount the volume.</p>
<p>Once that is done, here are some functions that I wrote to help manage these ACLs.</p>
<p>Here is an example of a command that grants apache permission to read a directory with these functions:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">source</span> aclfunctions.bash; grantUserRead <span style="color: #ff0000;">'apache'</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www <span style="color: #ff0000;">'*'</span>;</pre></div></div>

<p>aclfunctions.bash:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Author :: Bryan Geraghty</span>
<span style="color: #666666; font-style: italic;"># Date :: 2009-10-28</span>
<span style="color: #666666; font-style: italic;"># Notes :: ACL management functions</span>
&nbsp;
<span style="color: #666666; font-style: italic;">##</span>
<span style="color: #666666; font-style: italic;"># Resets permissions on all files and directories in the specified path and removes</span>
<span style="color: #666666; font-style: italic;"># and ACL entries</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># @param string $2 Base path Path in which all operations will take place</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">function</span> resetAll
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Resetting permissions on all files in directory $1&quot;</span>;
&nbsp;
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Removing ACLs...&quot;</span>;
   setfacl <span style="color: #660033;">-Rb</span> <span style="color: #007800;">$1</span>;
&nbsp;
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Resetting directories...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$1</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">770</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
&nbsp;
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Resetting files...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$1</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">660</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## </span>
<span style="color: #666666; font-style: italic;"># Grants read permissions to all files/folders with names matching $3, which reside</span>
<span style="color: #666666; font-style: italic;"># inside of directory $2, to user $1.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># @param string $1 Username The user to whom read permissions will be granted</span>
<span style="color: #666666; font-style: italic;"># @param string $2 Base path Path in which all operations will take place</span>
<span style="color: #666666; font-style: italic;"># @param string $3 Target Name of the file/directory on which to set the permissions</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">function</span> grantUserRead
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Granting read permission to user $1 on files/folders named $3 in directory $2&quot;</span>;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Set the default permissions for new files on the specified directory</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting defaults...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-d</span> <span style="color: #660033;">-m</span> u:<span style="color: #007800;">$1</span>:rx <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Recusively set the permissions on all existing directories and files within the</span>
   <span style="color: #666666; font-style: italic;">## specified directory</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting directory permissions...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-R</span> <span style="color: #660033;">-m</span> u:<span style="color: #007800;">$1</span>:rx <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Grant permissions to any files with the specified name</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting file permissions...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-m</span> u:<span style="color: #007800;">$1</span>:r <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## </span>
<span style="color: #666666; font-style: italic;"># Grants write permissions to all files/folders with names matching $3, which reside</span>
<span style="color: #666666; font-style: italic;"># inside of directory $2, to user $1.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># @param string $1 Username The user to whom read permissions will be granted</span>
<span style="color: #666666; font-style: italic;"># @param string $2 Base path Path in which all operations will take place</span>
<span style="color: #666666; font-style: italic;"># @param string $3 Target Name of the file/directory on which to set the permissions</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">function</span> grantUserWrite
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Granting write permission to user $1 on files/folders named $3 in directory $2&quot;</span>;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Set the default permissions for new files on the specified directory</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting defaults...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-d</span> <span style="color: #660033;">-m</span> u:<span style="color: #007800;">$1</span>:rwx <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Recusively set the permissions on all existing directories and files within the</span>
   <span style="color: #666666; font-style: italic;">## specified directory</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting directory permissions...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-R</span> <span style="color: #660033;">-m</span> u:<span style="color: #007800;">$1</span>:rwx <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Grant permissions to any files with the specified name</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting file permissions...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-m</span> u:<span style="color: #007800;">$1</span>:rw <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## </span>
<span style="color: #666666; font-style: italic;"># Grants read permissions to all files/folders with names matching $3, which reside</span>
<span style="color: #666666; font-style: italic;"># inside of directory $2, to group $1.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># @param string $1 Group The user to whom read permissions will be granted</span>
<span style="color: #666666; font-style: italic;"># @param string $2 Base path Path in which all operations will take place</span>
<span style="color: #666666; font-style: italic;"># @param string $3 Target Name of the file/directory on which to set the permissions</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">function</span> grantGroupRead
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Granting read permission to group $1 on files/folders named $3 in directory $2&quot;</span>;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Set the default permissions for new files on the specified directory</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting defaults...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-d</span> <span style="color: #660033;">-m</span> g:<span style="color: #007800;">$1</span>:rx <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Recusively set the permissions on all existing directories and files within the</span>
   <span style="color: #666666; font-style: italic;">## specified directory</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting directory permissions...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-R</span> <span style="color: #660033;">-m</span> g:<span style="color: #007800;">$1</span>:rx <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Grant permissions to any files with the specified name</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting file permissions...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span>  <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-m</span> g:<span style="color: #007800;">$1</span>:r <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## </span>
<span style="color: #666666; font-style: italic;"># Grants write permissions to all files/folders with names matching $3, which reside</span>
<span style="color: #666666; font-style: italic;"># inside of directory $2, to group $1.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># @param string $1 Group The user to whom read permissions will be granted</span>
<span style="color: #666666; font-style: italic;"># @param string $2 Base path Path in which all operations will take place</span>
<span style="color: #666666; font-style: italic;"># @param string $3 Target Name of the file/directory on which to set the permissions</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">function</span> grantGroupWrite 
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Granting write permission to group $1 on files/folders named $3 in directory $2&quot;</span>;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Set the default permissions for new files on the specified directory</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting defaults...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-d</span> <span style="color: #660033;">-m</span> g:<span style="color: #007800;">$1</span>:rwx <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Recusively set the permissions on all existing directories and files within the</span>
   <span style="color: #666666; font-style: italic;">## specified directory</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting directory permissions...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-R</span> <span style="color: #660033;">-m</span> g:<span style="color: #007800;">$1</span>:rwx <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Grant permissions to any files with the specified name</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting file permissions...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-m</span> g:<span style="color: #007800;">$1</span>:rw <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \; 
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## </span>
<span style="color: #666666; font-style: italic;"># Grants execute permissions to all files/folders with names matching $3, which reside</span>
<span style="color: #666666; font-style: italic;"># inside of directory $2, to user $1.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># @param string $1 Username The user to whom read permissions will be granted</span>
<span style="color: #666666; font-style: italic;"># @param string $2 Base path Path in which all operations will take place</span>
<span style="color: #666666; font-style: italic;"># @param string $3 Target Name of the file/directory on which to set the permissions</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">function</span> grantUserExec
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Granting execute permission to user $1 on files/folders named $3 in directory $2&quot;</span>;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Set the default permissions for new files on the specified directory</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting defaults...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-d</span> <span style="color: #660033;">-m</span> u:<span style="color: #007800;">$1</span>:rwx <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Recusively set the permissions on all existing directories and files within the</span>
   <span style="color: #666666; font-style: italic;">## specified directory. One command will siffice for files and directories when</span>
   <span style="color: #666666; font-style: italic;">## setting execute permissions </span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting directory and file permissions...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-R</span> <span style="color: #660033;">-m</span> u:<span style="color: #007800;">$1</span>:rwx <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## </span>
<span style="color: #666666; font-style: italic;"># Grants execute permissions to all files/folders with names matching $3, which reside</span>
<span style="color: #666666; font-style: italic;"># inside of directory $2, to group $1.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># @param string $1 Group The user to whom read permissions will be granted</span>
<span style="color: #666666; font-style: italic;"># @param string $2 Base path Path in which all operations will take place</span>
<span style="color: #666666; font-style: italic;"># @param string $3 Target Name of the file/directory on which to set the permissions</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">function</span> grantGroupExec
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Granting execute permission to group $1 on files/folders named $3 in directory $2&quot;</span>;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Set the default permissions for new files on the specified directory</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting defaults...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-d</span> <span style="color: #660033;">-m</span> g:<span style="color: #007800;">$1</span>:rwx <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
&nbsp;
   <span style="color: #666666; font-style: italic;">## Recusively set the permissions on all existing directories and files within the</span>
   <span style="color: #666666; font-style: italic;">## specified directory. One command will siffice for files and directories when</span>
   <span style="color: #666666; font-style: italic;">## setting execute permissions </span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting directory and file permissions...&quot;</span>;
   <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #007800;">$2</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #660033;">-exec</span> setfacl <span style="color: #660033;">-R</span> <span style="color: #660033;">-m</span> g:<span style="color: #007800;">$1</span>:rwx <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://bryan.ravensight.org/2010/01/linux-acl-management-functions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

