<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.amahi.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Inquam</id>
	<title>Amahi Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.amahi.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Inquam"/>
	<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php/Special:Contributions/Inquam"/>
	<updated>2026-04-30T18:37:43Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Secure_SSH_against_brute_force_attacks&amp;diff=73016</id>
		<title>Secure SSH against brute force attacks</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Secure_SSH_against_brute_force_attacks&amp;diff=73016"/>
		<updated>2013-08-30T06:09:09Z</updated>

		<summary type="html">&lt;p&gt;Inquam: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;With more and more people installing Amahi we have more and more Amahi's exposed to the internet when people start opening up ports in their routers to be able to access their servers remotely. Since SSH is used by many this is often also exposed outwards. This opens up for SSH brute force attacks (which can be both fast and effective).&lt;br /&gt;
&lt;br /&gt;
 [root@dahome ~]# iptables --list&lt;br /&gt;
 Chain INPUT (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
  ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh state NEW recent: SET name: SSH side: source mask: 255.255.255.255&lt;br /&gt;
  LOG        tcp  --  anywhere             anywhere             tcp dpt:ssh recent: UPDATE seconds: 60 hit_count: 4 TTL-Match name: SSH side: source mask: 255.255.255.255 LOG level  warning prefix &amp;quot;SSH_brute_force &amp;quot; &lt;br /&gt;
  DROP       tcp  --  anywhere             anywhere             tcp dpt:ssh recent: UPDATE seconds: 60 hit_count: 4 TTL-Match name: SSH side: source mask: 255.255.255.255&lt;br /&gt;
 Chain FORWARD (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
&lt;br /&gt;
There are many more or less elaborate ways of doing this, but these three simple rules add good basic protection. This will allow a couple of failed SSH login attempts and then add a 60 second cool down. Effectively killing any interest in brute forcing the server in question.&lt;br /&gt;
To add these rules run the following as root&lt;br /&gt;
&lt;br /&gt;
 iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --set --name SSH -j ACCEPT&lt;br /&gt;
 iptables -A INPUT -p tcp --dport 22 -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j LOG --log-prefix &amp;quot;SSH_brute_force &amp;quot;&lt;br /&gt;
 iptables -A INPUT -p tcp --dport 22 -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j DROP&lt;br /&gt;
&lt;br /&gt;
Rules created with the iptables command are stored in memory. If the system is restarted before saving the iptables rule set, all rules are lost. For netfilter rules to persist through a system reboot, they need to be saved. To save netfilter rules, type the following command as root&lt;br /&gt;
&lt;br /&gt;
 iptables-save &amp;gt; /etc/sysconfig/iptables&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt; This actually doesn't work for F19. They have changed things. So you will lose the settings on reboot and have to manually enter them again. Will update once I found the correct way for F19.&lt;br /&gt;
&lt;br /&gt;
What you can do for now is to create a simple script that executes the following on start up to restore the rules saved above&lt;br /&gt;
&lt;br /&gt;
 iptables-restore &amp;lt; /etc/sysconfig/ipdtables&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Disable root ssh access =&lt;br /&gt;
&lt;br /&gt;
Another tip is to disable root ssh access if you don't really need it since that is one of the most common user names used when brute forcing.&lt;br /&gt;
&lt;br /&gt;
= Alternative Ports =&lt;br /&gt;
&lt;br /&gt;
Another technique that can help reduce the automatic probes of the SSH port (port 22), is to use some alternative port. For instance, you could choose a port, say port 9988, and forward that (TCP) port from the outside of your router to your HDA's port 22. To connect to your HDA (in this example myhda.yourhda.com) from outside, you could then do:&lt;br /&gt;
&lt;br /&gt;
    ssh -p 9988 myhda.yourhda.com&lt;br /&gt;
&lt;br /&gt;
If this gets old, you can avoid the -p in the client configuration. In Linux/Mac OS X systems, this can be done with the .ssh/config file, by adding:&lt;br /&gt;
&lt;br /&gt;
    Host myhda.yourhda.com&lt;br /&gt;
            Port 9988&lt;br /&gt;
&lt;br /&gt;
and you will not need to type the -p in ssh or other programs that use ssh, like rsync, when accessing your host.&lt;br /&gt;
&lt;br /&gt;
= Other Techniques =&lt;br /&gt;
&lt;br /&gt;
Other techniques, in some case more advanced, include:&lt;br /&gt;
&lt;br /&gt;
* [http://www.linuxjournal.com/article/8957 Dual-factor authentication]&lt;br /&gt;
* [https://www.linux.com/learn/tutorials/351079-weekend-project-secure-your-system-with-port-knocking Port knocking]&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Secure_SSH_against_brute_force_attacks&amp;diff=72986</id>
		<title>Secure SSH against brute force attacks</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Secure_SSH_against_brute_force_attacks&amp;diff=72986"/>
		<updated>2013-08-29T13:36:27Z</updated>

		<summary type="html">&lt;p&gt;Inquam: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;With more and more people installing Amahi we have more and more Amahi's exposed to the internet when people start opening up ports in their routers to be able to access their servers remotely. Since SSH is used by many this is often also exposed outwards. This opens up for SSH brute force attacks (which can be both fast and effective).&lt;br /&gt;
&lt;br /&gt;
 [root@dahome ~]# iptables --list&lt;br /&gt;
 Chain INPUT (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
  ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh state NEW recent: SET name: SSH side: source mask: 255.255.255.255&lt;br /&gt;
  LOG        tcp  --  anywhere             anywhere             tcp dpt:ssh recent: UPDATE seconds: 60 hit_count: 4 TTL-Match name: SSH side: source mask: 255.255.255.255 LOG level  warning prefix &amp;quot;SSH_brute_force &amp;quot; &lt;br /&gt;
  DROP       tcp  --  anywhere             anywhere             tcp dpt:ssh recent: UPDATE seconds: 60 hit_count: 4 TTL-Match name: SSH side: source mask: 255.255.255.255&lt;br /&gt;
 Chain FORWARD (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
&lt;br /&gt;
There are many more or less elaborate ways of doing this, but these three simple rules add good basic protection. This will allow a couple of failed SSH login attempts and then add a 60 second cool down. Effectively killing any interest in brute forcing the server in question.&lt;br /&gt;
To add these rules run the following as root&lt;br /&gt;
&lt;br /&gt;
 iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --set --name SSH -j ACCEPT&lt;br /&gt;
 iptables -A INPUT -p tcp --dport 22 -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j LOG --log-prefix &amp;quot;SSH_brute_force &amp;quot;&lt;br /&gt;
 iptables -A INPUT -p tcp --dport 22 -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j DROP&lt;br /&gt;
&lt;br /&gt;
Rules created with the iptables command are stored in memory. If the system is restarted before saving the iptables rule set, all rules are lost. For netfilter rules to persist through a system reboot, they need to be saved. To save netfilter rules, type the following command as root&lt;br /&gt;
&lt;br /&gt;
 iptables-save &amp;gt; /etc/sysconfig/iptables&lt;br /&gt;
 - NOTE... This actually doesn't work for F19. They have changed things. So you will loos the settings on reboot and have to manually enter them again. Will udpate once I found the correct way for F19.&lt;br /&gt;
&lt;br /&gt;
= Disable root ssh access =&lt;br /&gt;
&lt;br /&gt;
Another tip is to disable root ssh access if you don't really need it since that is one of the most common user names used when brute forcing.&lt;br /&gt;
&lt;br /&gt;
= Alternative Ports =&lt;br /&gt;
&lt;br /&gt;
Another technique that can help reduce the automatic probes of the SSH port (port 22), is to use some alternative port. For instance, you could choose a port, say port 9988, and forward that (TCP) port from the outside of your router to your HDA's port 22. To connect to your HDA (in this example myhda.yourhda.com) from outside, you could then do:&lt;br /&gt;
&lt;br /&gt;
    ssh -p 9988 myhda.yourhda.com&lt;br /&gt;
&lt;br /&gt;
If this gets old, you can avoid the -p in the client configuration. In Linux/Mac OS X systems, this can be done with the .ssh/config file, by adding:&lt;br /&gt;
&lt;br /&gt;
    Host myhda.yourhda.com&lt;br /&gt;
            Port 9988&lt;br /&gt;
&lt;br /&gt;
and you will not need to type the -p in ssh or other programs that use ssh, like rsync, when accessing your host.&lt;br /&gt;
&lt;br /&gt;
= Other Techniques =&lt;br /&gt;
&lt;br /&gt;
Other techniques, in some case more advanced, include:&lt;br /&gt;
&lt;br /&gt;
* [http://www.linuxjournal.com/article/8957 Dual-factor authentication]&lt;br /&gt;
* [https://www.linux.com/learn/tutorials/351079-weekend-project-secure-your-system-with-port-knocking Port knocking]&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Secure_SSH_against_brute_force_attacks&amp;diff=72980</id>
		<title>Secure SSH against brute force attacks</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Secure_SSH_against_brute_force_attacks&amp;diff=72980"/>
		<updated>2013-08-29T06:54:40Z</updated>

		<summary type="html">&lt;p&gt;Inquam: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;With more and more people installing Amahi we have more and more Amahi's exposed to the internet when people start opening up ports in their routers to be able to access their servers remotely. Since SSH is used by many this is often also exposed outwards. This opens up for SSH brute force attacks (which can be both fast and effective).&lt;br /&gt;
&lt;br /&gt;
 [root@dahome ~]# iptables --list&lt;br /&gt;
 Chain INPUT (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
  ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh state NEW recent: SET name: SSH side: source mask: 255.255.255.255&lt;br /&gt;
  LOG        tcp  --  anywhere             anywhere             tcp dpt:ssh recent: UPDATE seconds: 60 hit_count: 4 TTL-Match name: SSH side: source mask: 255.255.255.255 LOG level  warning prefix &amp;quot;SSH_brute_force &amp;quot; &lt;br /&gt;
  DROP       tcp  --  anywhere             anywhere             tcp dpt:ssh recent: UPDATE seconds: 60 hit_count: 4 TTL-Match name: SSH side: source mask: 255.255.255.255&lt;br /&gt;
 Chain FORWARD (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
&lt;br /&gt;
There are many more or less elaborate ways of doing this, but these three simple rules add good basic protection. This will allow a couple of failed SSH login attempts and then add a 60 second cool down. Effectively killing any interest in brute forcing the server in question.&lt;br /&gt;
To add these rules run the following as root&lt;br /&gt;
&lt;br /&gt;
 iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --set --name SSH -j ACCEPT&lt;br /&gt;
 iptables -A INPUT -p tcp --dport 22 -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j LOG --log-prefix &amp;quot;SSH_brute_force &amp;quot;&lt;br /&gt;
 iptables -A INPUT -p tcp --dport 22 -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j DROP&lt;br /&gt;
&lt;br /&gt;
Rules created with the iptables command are stored in memory. If the system is restarted before saving the iptables rule set, all rules are lost. For netfilter rules to persist through a system reboot, they need to be saved. To save netfilter rules, type the following command as root&lt;br /&gt;
&lt;br /&gt;
 iptables-save &amp;gt; /etc/sysconfig/iptables&lt;br /&gt;
&lt;br /&gt;
= Disable root ssh access =&lt;br /&gt;
&lt;br /&gt;
Another tip is to disable root ssh access if you don't really need it since that is one of the most common user names used when brute forcing.&lt;br /&gt;
&lt;br /&gt;
= Alternative Ports =&lt;br /&gt;
&lt;br /&gt;
Another technique that can help reduce the automatic probes of the SSH port (port 22), is to use some alternative port. For instance, you could choose a port, say port 9988, and forward that (TCP) port from the outside of your router to your HDA's port 22. To connect to your HDA (in this example myhda.yourhda.com) from outside, you could then do:&lt;br /&gt;
&lt;br /&gt;
    ssh -p 9988 myhda.yourhda.com&lt;br /&gt;
&lt;br /&gt;
If this gets old, you can avoid the -p in the client configuration. In Linux/Mac OS X systems, this can be done with the .ssh/config file, by adding:&lt;br /&gt;
&lt;br /&gt;
    Host myhda.yourhda.com&lt;br /&gt;
            Port 9988&lt;br /&gt;
&lt;br /&gt;
and you will not need to type the -p in ssh or other programs that use ssh, like rsync, when accessing your host.&lt;br /&gt;
&lt;br /&gt;
= Other Techniques =&lt;br /&gt;
&lt;br /&gt;
Other techniques, in some case more advanced, include:&lt;br /&gt;
&lt;br /&gt;
* [http://www.linuxjournal.com/article/8957 Dual-factor authentication]&lt;br /&gt;
* [https://www.linux.com/learn/tutorials/351079-weekend-project-secure-your-system-with-port-knocking Port knocking]&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Secure_SSH_against_brute_force_attacks&amp;diff=72974</id>
		<title>Secure SSH against brute force attacks</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Secure_SSH_against_brute_force_attacks&amp;diff=72974"/>
		<updated>2013-08-29T06:36:50Z</updated>

		<summary type="html">&lt;p&gt;Inquam: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;With more and more people installing Amahi we have more and more Amahi's exposed to the internet when people start opening up ports in their routers to be able to access their servers remotely. Since SSH is used by many this is often also exposed outwards. This opens up for SSH brute force attacks (which can be both fast and effective).&lt;br /&gt;
&lt;br /&gt;
 [root@dahome ~]# iptables --list&lt;br /&gt;
 Chain INPUT (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
  ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh state NEW recent: SET name: SSH side: source mask: 255.255.255.255&lt;br /&gt;
  LOG        tcp  --  anywhere             anywhere             tcp dpt:ssh recent: UPDATE seconds: 60 hit_count: 4 TTL-Match name: SSH side: source mask: 255.255.255.255 LOG level  warning prefix &amp;quot;SSH_brute_force &amp;quot; &lt;br /&gt;
  DROP       tcp  --  anywhere             anywhere             tcp dpt:ssh recent: UPDATE seconds: 60 hit_count: 4 TTL-Match name: SSH side: source mask: 255.255.255.255&lt;br /&gt;
 Chain FORWARD (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
&lt;br /&gt;
This will allow a couple of failed SSH login attempts and then add a 60 second cool down. Effectively killing any interest in brute forcing the server in question.&lt;br /&gt;
Another tip is to disable root ssh access if you don't really need it since that is one of the most common user names used when brute forcing.&lt;br /&gt;
&lt;br /&gt;
= Alternative Ports =&lt;br /&gt;
&lt;br /&gt;
Another technique that can help reduce the automatic probes of the SSH port (port 22), is to use some alternative port. For instance, you could choose a port, say port 9988, and forward that (TCP) port from the outside of your router to your HDA's port 22. To connect to your HDA (in this example myhda.yourhda.com) from outside, you could then do:&lt;br /&gt;
&lt;br /&gt;
    ssh -p 9988 myhda.yourhda.com&lt;br /&gt;
&lt;br /&gt;
If this gets old, you can avoid the -p in the client configuration. In Linux/Mac OS X systems, this can be done with the .ssh/config file, by adding:&lt;br /&gt;
&lt;br /&gt;
    Host myhda.yourhda.com&lt;br /&gt;
            Port 9988&lt;br /&gt;
&lt;br /&gt;
and you will not need to type the -p in ssh or other programs that use ssh, like rsync, when accessing your host.&lt;br /&gt;
&lt;br /&gt;
= Other Techniques =&lt;br /&gt;
&lt;br /&gt;
Other techniques, in some case more advanced, include:&lt;br /&gt;
&lt;br /&gt;
* [http://www.linuxjournal.com/article/8957 Dual-factor authentication]&lt;br /&gt;
* [https://www.linux.com/learn/tutorials/351079-weekend-project-secure-your-system-with-port-knocking Port knocking]&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Secure_SSH_against_brute_force_attacks&amp;diff=72950</id>
		<title>Secure SSH against brute force attacks</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Secure_SSH_against_brute_force_attacks&amp;diff=72950"/>
		<updated>2013-08-28T13:25:19Z</updated>

		<summary type="html">&lt;p&gt;Inquam: Created page with &amp;quot;With more and more people installing Amahi we have more and more Amahi's exposed to the internet when people start opening up ports in their routers to be able to access their...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;With more and more people installing Amahi we have more and more Amahi's exposed to the internet when people start opening up ports in their routers to be able to access their servers remotely. Since SSH is used by many this is often also exposed outwards. This opens up for SSH brute force attacks (which can be both fast and effective).&lt;br /&gt;
To bring some kind of default protection to the platform against this I purpose that we include the following iptable rules by default&lt;br /&gt;
&lt;br /&gt;
 [root@dahome ~]# iptables --list&lt;br /&gt;
 Chain INPUT (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
  ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh state NEW recent: SET name: SSH side: source mask: 255.255.255.255&lt;br /&gt;
  LOG        tcp  --  anywhere             anywhere             tcp dpt:ssh recent: UPDATE seconds: 60 hit_count: 4 TTL-Match name: SSH side: source mask: 255.255.255.255 LOG level  warning prefix &amp;quot;SSH_brute_force &amp;quot; &lt;br /&gt;
  DROP       tcp  --  anywhere             anywhere             tcp dpt:ssh recent: UPDATE seconds: 60 hit_count: 4 TTL-Match name: SSH side: source mask: 255.255.255.255&lt;br /&gt;
 Chain FORWARD (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT)&lt;br /&gt;
  target     prot opt source               destination&lt;br /&gt;
&lt;br /&gt;
This will allow a couple of failed SSH login attempts and then add a 60 second cool down. Effectively killing any interest in brute forcing the server in question.&lt;br /&gt;
Another tip is to disable root ssh access if you don't really need it since that is one of the most common user names used when brute forcing.&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=72284</id>
		<title>Mount Shares Locally</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=72284"/>
		<updated>2013-08-05T07:44:20Z</updated>

		<summary type="html">&lt;p&gt;Inquam: /* Updated script for Greyhole users */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{MessageBox|&lt;br /&gt;
backgroundcolor	= #faa|&lt;br /&gt;
image	=Warning.png|&lt;br /&gt;
heading	=WARNING|&lt;br /&gt;
message = This is recommended only for advanced users, proceed with caution.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt;  Recommend not using copy and paste for the steps below.  It often introduces hidden characters which causes failure in the script.&lt;br /&gt;
&lt;br /&gt;
Mounting your Samba shares locally is useful when you are using Greyhole, and want to write or in any way work with those files locally. Greyhole data should only be accessed through shares, so mounting those shares locally is an easy way to work with Greyhole data safely.&lt;br /&gt;
&lt;br /&gt;
== Download and Setup ==&lt;br /&gt;
&lt;br /&gt;
* As '''root:''' Install the mount_shares_locally initd script:&lt;br /&gt;
=== On Ubuntu ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 sudo apt-get install cifs-utils curl&lt;br /&gt;
 sudo curl -o /etc/init.d/mount_shares_locally http://dl.amahi.org/mount_shares_locally&lt;br /&gt;
 sudo chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 sudo update-rc.d mount_shares_locally defaults&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On Fedora ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 curl -o /etc/init.d/mount_shares_locally http://dl.dropboxusercontent.com/u/3022105/Amahi/mount_shares_locally&lt;br /&gt;
 chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 chkconfig --add mount_shares_locally&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
* Edit /etc/init.d/mount_shares_locally (as user root) in a text editor, and replace ''your_username'' (on line 12) with your username. Example '''username=&amp;quot;amahi&amp;quot;'''&lt;br /&gt;
{{Code|Code= nano /etc/init.d/mount_shares_locally}}&lt;br /&gt;
* Create the ''/home/your_username/.smb_credentials'' file. This is a simple text file (use your favorite text editor).&lt;br /&gt;
{{Code|Code= nano /home/YourHDA_username/.smb_credentials}}&lt;br /&gt;
*Enter the following:&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;&amp;quot;&amp;gt;&lt;br /&gt;
 username=your_username&lt;br /&gt;
 password=your_password&lt;br /&gt;
 domain=HOME&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
'''NOTE:'''  your_username and your_password in the .smb_credentials file needs to be the original username and password you created when you installed fedora.&lt;br /&gt;
&lt;br /&gt;
*To test your new mounts, you can execute '''service mount_shares_locally start''' (as root user)&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''service mount_shares_locally stop''' (as root user) will unmount the local shares.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' If you used /etc/rc.local and /etc/fstab to mount shares locally in the past, you can remove what you added in those files now (&amp;lt;u&amp;gt;DO NOT&amp;lt;/u&amp;gt; remove the drive mount lines). The above initd script replaces all this.&lt;br /&gt;
&lt;br /&gt;
== Re-mount to Add new shares ==&lt;br /&gt;
If you added new share to greyhole via the web admin.  This does not automatically mount locally.  You need to restart your mount script by running '''service mount_shares_locally restart'''.  This will unmount and remount all your shares, adding all the new shares you added.&lt;br /&gt;
&lt;br /&gt;
== Where everything is mounted ==&lt;br /&gt;
You will find the mounted shares in ''/mnt/samba/*''&amp;lt;br/&amp;gt;&lt;br /&gt;
For example, your &amp;quot;Pictures&amp;quot; share would be located at '''/mnt/samba/Pictures'''.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt;  When working with files on the HDA, access them via this share and &amp;lt;u&amp;gt;NOT&amp;lt;/u&amp;gt; the traditional /var/hda/files/pictures location.&lt;br /&gt;
&lt;br /&gt;
== Unable to mount locally after upgrading to Amahi6 ==&lt;br /&gt;
If you try to run mount using this script after you upgraded to Amahi6 you might get greeted by this type of error.&lt;br /&gt;
&lt;br /&gt;
 [root@localhost ~]# /etc/init.d/mount_shares_locally start&lt;br /&gt;
 Mounting Samba shares locally: /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
                                                           [  OK  ]&lt;br /&gt;
&lt;br /&gt;
It's easily fixed by installing the missing dependency.&lt;br /&gt;
&lt;br /&gt;
{{Code|yum install cifs-utils}}&lt;br /&gt;
&lt;br /&gt;
Now it should work fine to run&lt;br /&gt;
&lt;br /&gt;
{{Code|/etc/init.d/mount_shares_locally start}}&lt;br /&gt;
&lt;br /&gt;
== MySQL Problems With Newer Versions of Greyhole ==&lt;br /&gt;
&lt;br /&gt;
Since Greyhole moved from SQL Lite to MySQL, you may hit a problem where Greyhole and the mount_shares_locally script both attempt to start before MySQL in bootup, leading to the services not starting properly.  If this happens, you can try this to fix it:&lt;br /&gt;
&lt;br /&gt;
{{Code|ls /etc/rc.d/rc3.d/}}&lt;br /&gt;
* Look for any entries marked S-1.  If there are any, they need to be removed.  Run the following as root:&lt;br /&gt;
&lt;br /&gt;
{{Code|rm S-1*}}&lt;br /&gt;
&lt;br /&gt;
== Updated script for Greyhole users ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some apps used by Amahi are used to download files etc. Often we want these files to end up in our shares. Let's say that SickBeard is used to download TV episodes. You then have to configure SickBeard to place your new episode somewhere. A logical place is to save to the landing zone of your Greyhole share which could be ''/var/hda/files/TV''. There are two downsides to this though.&lt;br /&gt;
&lt;br /&gt;
* Greyhole is not notified of the fact that a file is added and only discovers it and makes it available in your share after a ''fsck'', which could take a long time.&lt;br /&gt;
* Files deleted through apps in this folder don't register a ''delete'' event that Greyhole can pick up and thus only the symlink in the landing zone is removed. The actual file copies remain on disc. Similarly users running Plex Media Server for example will have issues if the clients are allowed to ''delete contents'' and the server is configured to work on the landing zone. I described this issue when packaging Plex a long time ago here: https://wiki.amahi.org/index.php/Plex_Media_Server&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since Greyhole uses Samba as a layer between the user and itself we would like to keep our writes and deletes to the shares and not the actual landing zone. But since apps (most of them) run as the user ''apache'' it will not be able to access ''/mnt/samba'', which is the default mount point if you set up ''mount_shares_locally''. This following script retains the function of the original script but also adds a second mount point under ''/mnt/apache'' where the ''apache'' user will have read and write access. I have kept it simple and it will use the same credentials as the ''main'' mount. So only shares available to that user will be available for apache.&lt;br /&gt;
&lt;br /&gt;
By doing this apache will now have a place where it is allowed to read and write files to your shares and SickBeard can thus be configured to place the new episode in ''/mnt/apache/TV'' which is then instantly picked up by Greyhole and file copies distributed to the discs in your pool as configured.&lt;br /&gt;
&lt;br /&gt;
Note that this script is based of the Greyhole original one and uses ''/etc/samba/smb.conf'' as the source of your shares and does not load the shares from the database like the old HDA version of the script did. If that behaviour is desired that can be easily added by replacing the lines&lt;br /&gt;
&lt;br /&gt;
 testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
 mysql -u root -phda -e &amp;quot;select comment from shares&amp;quot; hda_production | grep -v &amp;quot;^comment$&amp;quot; | xargs -d &amp;quot;\n&amp;quot; mkdir -p &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ### BEGIN INIT INFO&lt;br /&gt;
 # Provides:          mount_shares_locally&lt;br /&gt;
 # Required-Start:    $network $local_fs $remote_fs smb mysqld&lt;br /&gt;
 # Required-Stop:     $network $local_fs $remote_fs smb&lt;br /&gt;
 # Default-Start:     2 3 4 5&lt;br /&gt;
 # Default-Stop:      0 1 6&lt;br /&gt;
 # Short-Description: mount Samba shares locally&lt;br /&gt;
 ### END INIT INFO&lt;br /&gt;
 &lt;br /&gt;
 username=&amp;quot;YOURUSERHERE&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 if [ -f /etc/rc.d/init.d/functions ]; then&lt;br /&gt;
        . /etc/rc.d/init.d/functions&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 start () {&lt;br /&gt;
        uid=`id -u $username`&lt;br /&gt;
        gid=`id -g $username`&lt;br /&gt;
 &lt;br /&gt;
        echo -n $&amp;quot;Mounting Samba shares locally: &amp;quot;&lt;br /&gt;
        mkdir -p /mnt/samba/&lt;br /&gt;
        mkdir -p /mnt/apache/&lt;br /&gt;
        cd /mnt/apache/&lt;br /&gt;
        testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
        cd /mnt/samba/&lt;br /&gt;
        testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
        sleep 5&lt;br /&gt;
        ls -1 | while read d; do&lt;br /&gt;
                /sbin/mount.cifs &amp;quot;//127.0.0.1/$d&amp;quot; &amp;quot;$d&amp;quot; -o credentials=/home/${username}/.smb_credentials,uid=${uid},gid=${gid},file_mode=0660,dir_mode=0770,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks&lt;br /&gt;
                /sbin/mount.cifs &amp;quot;//127.0.0.1/$d&amp;quot; &amp;quot;/mnt/apache/$d&amp;quot; -o credentials=/home/${username}/.smb_credentials,uid=`id -u apache`,gid=`id -g apache`,file_mode=0777,dir_mode=0777,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks&lt;br /&gt;
        done&lt;br /&gt;
        touch /var/lock/subsys/mount_shares_locally&lt;br /&gt;
        success $&amp;quot;$base startup&amp;quot;&lt;br /&gt;
        echo&lt;br /&gt;
        return 0&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 stop () {&lt;br /&gt;
        echo -n $&amp;quot;Unmounting locally mounted Samba shares: &amp;quot;&lt;br /&gt;
        /bin/umount -l /mnt/samba/*&lt;br /&gt;
        /bin/umount -l /mnt/apache/*&lt;br /&gt;
        rm -f /var/lock/subsys/mount_shares_locally&lt;br /&gt;
        success $&amp;quot;$base shutdown&amp;quot;&lt;br /&gt;
        echo&lt;br /&gt;
        return 0&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 restart () {&lt;br /&gt;
        stop&lt;br /&gt;
        start&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 case &amp;quot;$1&amp;quot; in&lt;br /&gt;
        start)&lt;br /&gt;
                start&lt;br /&gt;
                ;;&lt;br /&gt;
        stop)&lt;br /&gt;
                stop&lt;br /&gt;
                ;;&lt;br /&gt;
        restart)&lt;br /&gt;
                restart&lt;br /&gt;
                ;;&lt;br /&gt;
        *)&lt;br /&gt;
                echo $&amp;quot;Usage: $0 {start|stop|restart}&amp;quot;&lt;br /&gt;
                exit 1&lt;br /&gt;
                ;;&lt;br /&gt;
 esac&lt;br /&gt;
 &lt;br /&gt;
 exit $?&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=72278</id>
		<title>Mount Shares Locally</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=72278"/>
		<updated>2013-08-05T07:43:25Z</updated>

		<summary type="html">&lt;p&gt;Inquam: /* Updated script for Greyhole users */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{MessageBox|&lt;br /&gt;
backgroundcolor	= #faa|&lt;br /&gt;
image	=Warning.png|&lt;br /&gt;
heading	=WARNING|&lt;br /&gt;
message = This is recommended only for advanced users, proceed with caution.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt;  Recommend not using copy and paste for the steps below.  It often introduces hidden characters which causes failure in the script.&lt;br /&gt;
&lt;br /&gt;
Mounting your Samba shares locally is useful when you are using Greyhole, and want to write or in any way work with those files locally. Greyhole data should only be accessed through shares, so mounting those shares locally is an easy way to work with Greyhole data safely.&lt;br /&gt;
&lt;br /&gt;
== Download and Setup ==&lt;br /&gt;
&lt;br /&gt;
* As '''root:''' Install the mount_shares_locally initd script:&lt;br /&gt;
=== On Ubuntu ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 sudo apt-get install cifs-utils curl&lt;br /&gt;
 sudo curl -o /etc/init.d/mount_shares_locally http://dl.amahi.org/mount_shares_locally&lt;br /&gt;
 sudo chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 sudo update-rc.d mount_shares_locally defaults&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On Fedora ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 curl -o /etc/init.d/mount_shares_locally http://dl.dropboxusercontent.com/u/3022105/Amahi/mount_shares_locally&lt;br /&gt;
 chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 chkconfig --add mount_shares_locally&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
* Edit /etc/init.d/mount_shares_locally (as user root) in a text editor, and replace ''your_username'' (on line 12) with your username. Example '''username=&amp;quot;amahi&amp;quot;'''&lt;br /&gt;
{{Code|Code= nano /etc/init.d/mount_shares_locally}}&lt;br /&gt;
* Create the ''/home/your_username/.smb_credentials'' file. This is a simple text file (use your favorite text editor).&lt;br /&gt;
{{Code|Code= nano /home/YourHDA_username/.smb_credentials}}&lt;br /&gt;
*Enter the following:&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;&amp;quot;&amp;gt;&lt;br /&gt;
 username=your_username&lt;br /&gt;
 password=your_password&lt;br /&gt;
 domain=HOME&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
'''NOTE:'''  your_username and your_password in the .smb_credentials file needs to be the original username and password you created when you installed fedora.&lt;br /&gt;
&lt;br /&gt;
*To test your new mounts, you can execute '''service mount_shares_locally start''' (as root user)&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''service mount_shares_locally stop''' (as root user) will unmount the local shares.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' If you used /etc/rc.local and /etc/fstab to mount shares locally in the past, you can remove what you added in those files now (&amp;lt;u&amp;gt;DO NOT&amp;lt;/u&amp;gt; remove the drive mount lines). The above initd script replaces all this.&lt;br /&gt;
&lt;br /&gt;
== Re-mount to Add new shares ==&lt;br /&gt;
If you added new share to greyhole via the web admin.  This does not automatically mount locally.  You need to restart your mount script by running '''service mount_shares_locally restart'''.  This will unmount and remount all your shares, adding all the new shares you added.&lt;br /&gt;
&lt;br /&gt;
== Where everything is mounted ==&lt;br /&gt;
You will find the mounted shares in ''/mnt/samba/*''&amp;lt;br/&amp;gt;&lt;br /&gt;
For example, your &amp;quot;Pictures&amp;quot; share would be located at '''/mnt/samba/Pictures'''.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt;  When working with files on the HDA, access them via this share and &amp;lt;u&amp;gt;NOT&amp;lt;/u&amp;gt; the traditional /var/hda/files/pictures location.&lt;br /&gt;
&lt;br /&gt;
== Unable to mount locally after upgrading to Amahi6 ==&lt;br /&gt;
If you try to run mount using this script after you upgraded to Amahi6 you might get greeted by this type of error.&lt;br /&gt;
&lt;br /&gt;
 [root@localhost ~]# /etc/init.d/mount_shares_locally start&lt;br /&gt;
 Mounting Samba shares locally: /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
                                                           [  OK  ]&lt;br /&gt;
&lt;br /&gt;
It's easily fixed by installing the missing dependency.&lt;br /&gt;
&lt;br /&gt;
{{Code|yum install cifs-utils}}&lt;br /&gt;
&lt;br /&gt;
Now it should work fine to run&lt;br /&gt;
&lt;br /&gt;
{{Code|/etc/init.d/mount_shares_locally start}}&lt;br /&gt;
&lt;br /&gt;
== MySQL Problems With Newer Versions of Greyhole ==&lt;br /&gt;
&lt;br /&gt;
Since Greyhole moved from SQL Lite to MySQL, you may hit a problem where Greyhole and the mount_shares_locally script both attempt to start before MySQL in bootup, leading to the services not starting properly.  If this happens, you can try this to fix it:&lt;br /&gt;
&lt;br /&gt;
{{Code|ls /etc/rc.d/rc3.d/}}&lt;br /&gt;
* Look for any entries marked S-1.  If there are any, they need to be removed.  Run the following as root:&lt;br /&gt;
&lt;br /&gt;
{{Code|rm S-1*}}&lt;br /&gt;
&lt;br /&gt;
== Updated script for Greyhole users ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some apps used by Amahi are used to download files etc. Often we want these files to end up in our shares. Let's say that SickBeard is used to download TV episodes. You then have to configure SickBeard to place your new episode somewhere. A logical place is to save to the landing zone of your Greyhole share which could be ''/var/hda/files/TV''. There are two downsides to this though.&lt;br /&gt;
&lt;br /&gt;
* Greyhole is not notified of the fact that a file is added and only discovers it and makes it available in your share after a ''fsck'', which could take a long time.&lt;br /&gt;
* Files deleted through apps in this folder don't register a ''delete'' event that Greyhole can pick up and thus only the symlink in the landing zone is removed. The actual file copies remain on disc. Similarly users running Plex Media Server for example will have issues if the clients are allowed to ''delete contents'' and the server is configured to work on the landing zone. I described this issue when packaging Plex a long time ago here: https://wiki.amahi.org/index.php/Plex_Media_Server&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since Greyhole uses Samba as a layer between the user and itself we would like to keep our writes and deletes to the shares and not the actual landing zone. But since apps (most of them) run as the user ''apache'' it will not be able to access ''/mnt/samba'', which is the default mount point if you set up ''mount_shares_locally''. This following script retains the function of the original script but also adds a second mount point under ''/mnt/apache'' where the ''apache'' user will have read and write access. I have kept it simple and it will use the same credentials as the ''main'' mount. So only shares available to that user will be available for apache.&lt;br /&gt;
&lt;br /&gt;
By doing this apache will now have a place where it is allowed to read and write files to your shares and SickBeard can thus be configured to place the new episode in ''/mnt/apache/TV'' which is the instantly picked up by Greyhole and file copies distributed to the discs in your pool as configured.&lt;br /&gt;
&lt;br /&gt;
Note that this script is based of the Greyhole original one and uses ''/etc/samba/smb.conf'' as the source of your shares and does not load the shares from the database like the old HDA version of the script did. If that behaviour is desired that can be easily added by replacing the lines&lt;br /&gt;
&lt;br /&gt;
 testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
 mysql -u root -phda -e &amp;quot;select comment from shares&amp;quot; hda_production | grep -v &amp;quot;^comment$&amp;quot; | xargs -d &amp;quot;\n&amp;quot; mkdir -p &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ### BEGIN INIT INFO&lt;br /&gt;
 # Provides:          mount_shares_locally&lt;br /&gt;
 # Required-Start:    $network $local_fs $remote_fs smb mysqld&lt;br /&gt;
 # Required-Stop:     $network $local_fs $remote_fs smb&lt;br /&gt;
 # Default-Start:     2 3 4 5&lt;br /&gt;
 # Default-Stop:      0 1 6&lt;br /&gt;
 # Short-Description: mount Samba shares locally&lt;br /&gt;
 ### END INIT INFO&lt;br /&gt;
 &lt;br /&gt;
 username=&amp;quot;YOURUSERHERE&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 if [ -f /etc/rc.d/init.d/functions ]; then&lt;br /&gt;
        . /etc/rc.d/init.d/functions&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 start () {&lt;br /&gt;
        uid=`id -u $username`&lt;br /&gt;
        gid=`id -g $username`&lt;br /&gt;
 &lt;br /&gt;
        echo -n $&amp;quot;Mounting Samba shares locally: &amp;quot;&lt;br /&gt;
        mkdir -p /mnt/samba/&lt;br /&gt;
        mkdir -p /mnt/apache/&lt;br /&gt;
        cd /mnt/apache/&lt;br /&gt;
        testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
        cd /mnt/samba/&lt;br /&gt;
        testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
        sleep 5&lt;br /&gt;
        ls -1 | while read d; do&lt;br /&gt;
                /sbin/mount.cifs &amp;quot;//127.0.0.1/$d&amp;quot; &amp;quot;$d&amp;quot; -o credentials=/home/${username}/.smb_credentials,uid=${uid},gid=${gid},file_mode=0660,dir_mode=0770,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks&lt;br /&gt;
                /sbin/mount.cifs &amp;quot;//127.0.0.1/$d&amp;quot; &amp;quot;/mnt/apache/$d&amp;quot; -o credentials=/home/${username}/.smb_credentials,uid=`id -u apache`,gid=`id -g apache`,file_mode=0777,dir_mode=0777,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks&lt;br /&gt;
        done&lt;br /&gt;
        touch /var/lock/subsys/mount_shares_locally&lt;br /&gt;
        success $&amp;quot;$base startup&amp;quot;&lt;br /&gt;
        echo&lt;br /&gt;
        return 0&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 stop () {&lt;br /&gt;
        echo -n $&amp;quot;Unmounting locally mounted Samba shares: &amp;quot;&lt;br /&gt;
        /bin/umount -l /mnt/samba/*&lt;br /&gt;
        /bin/umount -l /mnt/apache/*&lt;br /&gt;
        rm -f /var/lock/subsys/mount_shares_locally&lt;br /&gt;
        success $&amp;quot;$base shutdown&amp;quot;&lt;br /&gt;
        echo&lt;br /&gt;
        return 0&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 restart () {&lt;br /&gt;
        stop&lt;br /&gt;
        start&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 case &amp;quot;$1&amp;quot; in&lt;br /&gt;
        start)&lt;br /&gt;
                start&lt;br /&gt;
                ;;&lt;br /&gt;
        stop)&lt;br /&gt;
                stop&lt;br /&gt;
                ;;&lt;br /&gt;
        restart)&lt;br /&gt;
                restart&lt;br /&gt;
                ;;&lt;br /&gt;
        *)&lt;br /&gt;
                echo $&amp;quot;Usage: $0 {start|stop|restart}&amp;quot;&lt;br /&gt;
                exit 1&lt;br /&gt;
                ;;&lt;br /&gt;
 esac&lt;br /&gt;
 &lt;br /&gt;
 exit $?&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=72272</id>
		<title>Mount Shares Locally</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=72272"/>
		<updated>2013-08-05T07:43:12Z</updated>

		<summary type="html">&lt;p&gt;Inquam: /* Updated script for Greyhole users */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{MessageBox|&lt;br /&gt;
backgroundcolor	= #faa|&lt;br /&gt;
image	=Warning.png|&lt;br /&gt;
heading	=WARNING|&lt;br /&gt;
message = This is recommended only for advanced users, proceed with caution.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt;  Recommend not using copy and paste for the steps below.  It often introduces hidden characters which causes failure in the script.&lt;br /&gt;
&lt;br /&gt;
Mounting your Samba shares locally is useful when you are using Greyhole, and want to write or in any way work with those files locally. Greyhole data should only be accessed through shares, so mounting those shares locally is an easy way to work with Greyhole data safely.&lt;br /&gt;
&lt;br /&gt;
== Download and Setup ==&lt;br /&gt;
&lt;br /&gt;
* As '''root:''' Install the mount_shares_locally initd script:&lt;br /&gt;
=== On Ubuntu ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 sudo apt-get install cifs-utils curl&lt;br /&gt;
 sudo curl -o /etc/init.d/mount_shares_locally http://dl.amahi.org/mount_shares_locally&lt;br /&gt;
 sudo chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 sudo update-rc.d mount_shares_locally defaults&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On Fedora ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 curl -o /etc/init.d/mount_shares_locally http://dl.dropboxusercontent.com/u/3022105/Amahi/mount_shares_locally&lt;br /&gt;
 chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 chkconfig --add mount_shares_locally&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
* Edit /etc/init.d/mount_shares_locally (as user root) in a text editor, and replace ''your_username'' (on line 12) with your username. Example '''username=&amp;quot;amahi&amp;quot;'''&lt;br /&gt;
{{Code|Code= nano /etc/init.d/mount_shares_locally}}&lt;br /&gt;
* Create the ''/home/your_username/.smb_credentials'' file. This is a simple text file (use your favorite text editor).&lt;br /&gt;
{{Code|Code= nano /home/YourHDA_username/.smb_credentials}}&lt;br /&gt;
*Enter the following:&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;&amp;quot;&amp;gt;&lt;br /&gt;
 username=your_username&lt;br /&gt;
 password=your_password&lt;br /&gt;
 domain=HOME&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
'''NOTE:'''  your_username and your_password in the .smb_credentials file needs to be the original username and password you created when you installed fedora.&lt;br /&gt;
&lt;br /&gt;
*To test your new mounts, you can execute '''service mount_shares_locally start''' (as root user)&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''service mount_shares_locally stop''' (as root user) will unmount the local shares.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' If you used /etc/rc.local and /etc/fstab to mount shares locally in the past, you can remove what you added in those files now (&amp;lt;u&amp;gt;DO NOT&amp;lt;/u&amp;gt; remove the drive mount lines). The above initd script replaces all this.&lt;br /&gt;
&lt;br /&gt;
== Re-mount to Add new shares ==&lt;br /&gt;
If you added new share to greyhole via the web admin.  This does not automatically mount locally.  You need to restart your mount script by running '''service mount_shares_locally restart'''.  This will unmount and remount all your shares, adding all the new shares you added.&lt;br /&gt;
&lt;br /&gt;
== Where everything is mounted ==&lt;br /&gt;
You will find the mounted shares in ''/mnt/samba/*''&amp;lt;br/&amp;gt;&lt;br /&gt;
For example, your &amp;quot;Pictures&amp;quot; share would be located at '''/mnt/samba/Pictures'''.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt;  When working with files on the HDA, access them via this share and &amp;lt;u&amp;gt;NOT&amp;lt;/u&amp;gt; the traditional /var/hda/files/pictures location.&lt;br /&gt;
&lt;br /&gt;
== Unable to mount locally after upgrading to Amahi6 ==&lt;br /&gt;
If you try to run mount using this script after you upgraded to Amahi6 you might get greeted by this type of error.&lt;br /&gt;
&lt;br /&gt;
 [root@localhost ~]# /etc/init.d/mount_shares_locally start&lt;br /&gt;
 Mounting Samba shares locally: /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
                                                           [  OK  ]&lt;br /&gt;
&lt;br /&gt;
It's easily fixed by installing the missing dependency.&lt;br /&gt;
&lt;br /&gt;
{{Code|yum install cifs-utils}}&lt;br /&gt;
&lt;br /&gt;
Now it should work fine to run&lt;br /&gt;
&lt;br /&gt;
{{Code|/etc/init.d/mount_shares_locally start}}&lt;br /&gt;
&lt;br /&gt;
== MySQL Problems With Newer Versions of Greyhole ==&lt;br /&gt;
&lt;br /&gt;
Since Greyhole moved from SQL Lite to MySQL, you may hit a problem where Greyhole and the mount_shares_locally script both attempt to start before MySQL in bootup, leading to the services not starting properly.  If this happens, you can try this to fix it:&lt;br /&gt;
&lt;br /&gt;
{{Code|ls /etc/rc.d/rc3.d/}}&lt;br /&gt;
* Look for any entries marked S-1.  If there are any, they need to be removed.  Run the following as root:&lt;br /&gt;
&lt;br /&gt;
{{Code|rm S-1*}}&lt;br /&gt;
&lt;br /&gt;
== Updated script for Greyhole users ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some apps used by Amahi are used to download files etc. Often we want these files to end up in our shares. Let's say that SickBeard is used to download TV episodes. You then have to configure SickBeard to place your new episode somewhere. A logical place is to save to the landing zone of your Greyhole share which could be ''/var/hda/files/TV''. There are two downsides to this though.&lt;br /&gt;
&lt;br /&gt;
* Greyhole is not notified of the fact that a file is added and only discovers it and makes it available in your share after a ''fsck'', which could take a long time.&lt;br /&gt;
* Files deleted through apps in this folder don't register a ''delete'' event that Greyhole can pick up and thus only the symlink in the landing zone is removed. The actual file copies remain on disc. Similarly users running Plex Media Server for example will have issues if the clients are allowed to ''delete contents'' and the server is configured to work on the landing zone. I described this issue when packaging Plex a long time ago here: https://wiki.amahi.org/index.php/Plex_Media_Server&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since Greyhole uses Samba as a layer between the user and itself we would like to keep our writes and deletes to the shares and not the actual landing zone. But since apps (most of them) run as the user ''apache'' it will not be able to access ''/mnt/samba'', which is the default mount point if you set up ''mount_shares_locally''. This following script retains the function of the original script but also adds a second mount point under ''/mnt/apache'' where the ''apache'' user will have read and write access. I have kept it simple and it will use the same credentials as the ''main'' mount. So only shares available to that user will ea available for apache.&lt;br /&gt;
&lt;br /&gt;
By doing this apache will now have a place where it is allowed to read and write files to your shares and SickBeard can thus be configured to place the new episode in ''/mnt/apache/TV'' which is the instantly picked up by Greyhole and file copies distributed to the discs in your pool as configured.&lt;br /&gt;
&lt;br /&gt;
Note that this script is based of the Greyhole original one and uses ''/etc/samba/smb.conf'' as the source of your shares and does not load the shares from the database like the old HDA version of the script did. If that behaviour is desired that can be easily added by replacing the lines&lt;br /&gt;
&lt;br /&gt;
 testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
 mysql -u root -phda -e &amp;quot;select comment from shares&amp;quot; hda_production | grep -v &amp;quot;^comment$&amp;quot; | xargs -d &amp;quot;\n&amp;quot; mkdir -p &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ### BEGIN INIT INFO&lt;br /&gt;
 # Provides:          mount_shares_locally&lt;br /&gt;
 # Required-Start:    $network $local_fs $remote_fs smb mysqld&lt;br /&gt;
 # Required-Stop:     $network $local_fs $remote_fs smb&lt;br /&gt;
 # Default-Start:     2 3 4 5&lt;br /&gt;
 # Default-Stop:      0 1 6&lt;br /&gt;
 # Short-Description: mount Samba shares locally&lt;br /&gt;
 ### END INIT INFO&lt;br /&gt;
 &lt;br /&gt;
 username=&amp;quot;YOURUSERHERE&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 if [ -f /etc/rc.d/init.d/functions ]; then&lt;br /&gt;
        . /etc/rc.d/init.d/functions&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 start () {&lt;br /&gt;
        uid=`id -u $username`&lt;br /&gt;
        gid=`id -g $username`&lt;br /&gt;
 &lt;br /&gt;
        echo -n $&amp;quot;Mounting Samba shares locally: &amp;quot;&lt;br /&gt;
        mkdir -p /mnt/samba/&lt;br /&gt;
        mkdir -p /mnt/apache/&lt;br /&gt;
        cd /mnt/apache/&lt;br /&gt;
        testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
        cd /mnt/samba/&lt;br /&gt;
        testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
        sleep 5&lt;br /&gt;
        ls -1 | while read d; do&lt;br /&gt;
                /sbin/mount.cifs &amp;quot;//127.0.0.1/$d&amp;quot; &amp;quot;$d&amp;quot; -o credentials=/home/${username}/.smb_credentials,uid=${uid},gid=${gid},file_mode=0660,dir_mode=0770,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks&lt;br /&gt;
                /sbin/mount.cifs &amp;quot;//127.0.0.1/$d&amp;quot; &amp;quot;/mnt/apache/$d&amp;quot; -o credentials=/home/${username}/.smb_credentials,uid=`id -u apache`,gid=`id -g apache`,file_mode=0777,dir_mode=0777,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks&lt;br /&gt;
        done&lt;br /&gt;
        touch /var/lock/subsys/mount_shares_locally&lt;br /&gt;
        success $&amp;quot;$base startup&amp;quot;&lt;br /&gt;
        echo&lt;br /&gt;
        return 0&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 stop () {&lt;br /&gt;
        echo -n $&amp;quot;Unmounting locally mounted Samba shares: &amp;quot;&lt;br /&gt;
        /bin/umount -l /mnt/samba/*&lt;br /&gt;
        /bin/umount -l /mnt/apache/*&lt;br /&gt;
        rm -f /var/lock/subsys/mount_shares_locally&lt;br /&gt;
        success $&amp;quot;$base shutdown&amp;quot;&lt;br /&gt;
        echo&lt;br /&gt;
        return 0&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 restart () {&lt;br /&gt;
        stop&lt;br /&gt;
        start&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 case &amp;quot;$1&amp;quot; in&lt;br /&gt;
        start)&lt;br /&gt;
                start&lt;br /&gt;
                ;;&lt;br /&gt;
        stop)&lt;br /&gt;
                stop&lt;br /&gt;
                ;;&lt;br /&gt;
        restart)&lt;br /&gt;
                restart&lt;br /&gt;
                ;;&lt;br /&gt;
        *)&lt;br /&gt;
                echo $&amp;quot;Usage: $0 {start|stop|restart}&amp;quot;&lt;br /&gt;
                exit 1&lt;br /&gt;
                ;;&lt;br /&gt;
 esac&lt;br /&gt;
 &lt;br /&gt;
 exit $?&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=72266</id>
		<title>Mount Shares Locally</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=72266"/>
		<updated>2013-08-05T07:42:03Z</updated>

		<summary type="html">&lt;p&gt;Inquam: /* Updated script for Greyhole users */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{MessageBox|&lt;br /&gt;
backgroundcolor	= #faa|&lt;br /&gt;
image	=Warning.png|&lt;br /&gt;
heading	=WARNING|&lt;br /&gt;
message = This is recommended only for advanced users, proceed with caution.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt;  Recommend not using copy and paste for the steps below.  It often introduces hidden characters which causes failure in the script.&lt;br /&gt;
&lt;br /&gt;
Mounting your Samba shares locally is useful when you are using Greyhole, and want to write or in any way work with those files locally. Greyhole data should only be accessed through shares, so mounting those shares locally is an easy way to work with Greyhole data safely.&lt;br /&gt;
&lt;br /&gt;
== Download and Setup ==&lt;br /&gt;
&lt;br /&gt;
* As '''root:''' Install the mount_shares_locally initd script:&lt;br /&gt;
=== On Ubuntu ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 sudo apt-get install cifs-utils curl&lt;br /&gt;
 sudo curl -o /etc/init.d/mount_shares_locally http://dl.amahi.org/mount_shares_locally&lt;br /&gt;
 sudo chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 sudo update-rc.d mount_shares_locally defaults&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On Fedora ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 curl -o /etc/init.d/mount_shares_locally http://dl.dropboxusercontent.com/u/3022105/Amahi/mount_shares_locally&lt;br /&gt;
 chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 chkconfig --add mount_shares_locally&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
* Edit /etc/init.d/mount_shares_locally (as user root) in a text editor, and replace ''your_username'' (on line 12) with your username. Example '''username=&amp;quot;amahi&amp;quot;'''&lt;br /&gt;
{{Code|Code= nano /etc/init.d/mount_shares_locally}}&lt;br /&gt;
* Create the ''/home/your_username/.smb_credentials'' file. This is a simple text file (use your favorite text editor).&lt;br /&gt;
{{Code|Code= nano /home/YourHDA_username/.smb_credentials}}&lt;br /&gt;
*Enter the following:&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;&amp;quot;&amp;gt;&lt;br /&gt;
 username=your_username&lt;br /&gt;
 password=your_password&lt;br /&gt;
 domain=HOME&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
'''NOTE:'''  your_username and your_password in the .smb_credentials file needs to be the original username and password you created when you installed fedora.&lt;br /&gt;
&lt;br /&gt;
*To test your new mounts, you can execute '''service mount_shares_locally start''' (as root user)&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''service mount_shares_locally stop''' (as root user) will unmount the local shares.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' If you used /etc/rc.local and /etc/fstab to mount shares locally in the past, you can remove what you added in those files now (&amp;lt;u&amp;gt;DO NOT&amp;lt;/u&amp;gt; remove the drive mount lines). The above initd script replaces all this.&lt;br /&gt;
&lt;br /&gt;
== Re-mount to Add new shares ==&lt;br /&gt;
If you added new share to greyhole via the web admin.  This does not automatically mount locally.  You need to restart your mount script by running '''service mount_shares_locally restart'''.  This will unmount and remount all your shares, adding all the new shares you added.&lt;br /&gt;
&lt;br /&gt;
== Where everything is mounted ==&lt;br /&gt;
You will find the mounted shares in ''/mnt/samba/*''&amp;lt;br/&amp;gt;&lt;br /&gt;
For example, your &amp;quot;Pictures&amp;quot; share would be located at '''/mnt/samba/Pictures'''.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt;  When working with files on the HDA, access them via this share and &amp;lt;u&amp;gt;NOT&amp;lt;/u&amp;gt; the traditional /var/hda/files/pictures location.&lt;br /&gt;
&lt;br /&gt;
== Unable to mount locally after upgrading to Amahi6 ==&lt;br /&gt;
If you try to run mount using this script after you upgraded to Amahi6 you might get greeted by this type of error.&lt;br /&gt;
&lt;br /&gt;
 [root@localhost ~]# /etc/init.d/mount_shares_locally start&lt;br /&gt;
 Mounting Samba shares locally: /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
                                                           [  OK  ]&lt;br /&gt;
&lt;br /&gt;
It's easily fixed by installing the missing dependency.&lt;br /&gt;
&lt;br /&gt;
{{Code|yum install cifs-utils}}&lt;br /&gt;
&lt;br /&gt;
Now it should work fine to run&lt;br /&gt;
&lt;br /&gt;
{{Code|/etc/init.d/mount_shares_locally start}}&lt;br /&gt;
&lt;br /&gt;
== MySQL Problems With Newer Versions of Greyhole ==&lt;br /&gt;
&lt;br /&gt;
Since Greyhole moved from SQL Lite to MySQL, you may hit a problem where Greyhole and the mount_shares_locally script both attempt to start before MySQL in bootup, leading to the services not starting properly.  If this happens, you can try this to fix it:&lt;br /&gt;
&lt;br /&gt;
{{Code|ls /etc/rc.d/rc3.d/}}&lt;br /&gt;
* Look for any entries marked S-1.  If there are any, they need to be removed.  Run the following as root:&lt;br /&gt;
&lt;br /&gt;
{{Code|rm S-1*}}&lt;br /&gt;
&lt;br /&gt;
== Updated script for Greyhole users ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some apps used by Amahi are used to download files etc. Often we want these files to end up in our shares. Let's say that SickBeard is used to download TV episodes. You then have to configure SickBeard to place your new episode somewhere. A logical place is to save to the landing zone of your Greyhole share which could be ''/var/hda/files/TV''. There are two downsides to this though.&lt;br /&gt;
&lt;br /&gt;
* Greyhole is not notified of the fact that a file is added and only discovers it and makes it available in your share after a ''fsck'', which could take a long time.&lt;br /&gt;
* Files deleted through apps in this folder don't register a ''delete'' event that Greyhole can pick up and thus only the symlink in the landing zone is removed. The actual file copies remain on disc. Similarly users running Plex Media Server for example will have issues if the clients are allowed to ''delete contents'' and the server is configured to work on the landing zone. I described this issue when packaging Plex a long time ago here: https://wiki.amahi.org/index.php/Plex_Media_Server&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since Greyhole uses Samba as a layer between the user and itself we would like to keep our writes and deletes to the shares and not the actual landing zone. But since apps (most of them) run as the user ''apache'' it will not be able to access ''/mnt/samba'' which is the default mount point if you set up ''mount_shares_locally''. This following script retains the function of the original script but also adds a second mount point under ''/mnt/apache'' where the ''apache'' user will have read and write access. I have kept it simple and it will use the same credentials as the ''main'' mount. So only shares available to that user will ea available for apache.&lt;br /&gt;
&lt;br /&gt;
By doing this apache will now have a place where it is allowed to read and write files to your shares and SickBeard can thus be configured to place the new episode in ''/mnt/apache/TV'' which is the instantly picked up by Greyhole and file copies distributed to the discs in your pool as configured.&lt;br /&gt;
&lt;br /&gt;
Note that this script is based of the Greyhole original one and uses ''/etc/samba/smb.conf'' as the source of your shares and does not load the shares from the database like the old HDA version of the script did. If that behaviour is desired that can be easily added by replacing the lines&lt;br /&gt;
&lt;br /&gt;
 testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
 mysql -u root -phda -e &amp;quot;select comment from shares&amp;quot; hda_production | grep -v &amp;quot;^comment$&amp;quot; | xargs -d &amp;quot;\n&amp;quot; mkdir -p &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ### BEGIN INIT INFO&lt;br /&gt;
 # Provides:          mount_shares_locally&lt;br /&gt;
 # Required-Start:    $network $local_fs $remote_fs smb mysqld&lt;br /&gt;
 # Required-Stop:     $network $local_fs $remote_fs smb&lt;br /&gt;
 # Default-Start:     2 3 4 5&lt;br /&gt;
 # Default-Stop:      0 1 6&lt;br /&gt;
 # Short-Description: mount Samba shares locally&lt;br /&gt;
 ### END INIT INFO&lt;br /&gt;
 &lt;br /&gt;
 username=&amp;quot;YOURUSERHERE&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 if [ -f /etc/rc.d/init.d/functions ]; then&lt;br /&gt;
        . /etc/rc.d/init.d/functions&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 start () {&lt;br /&gt;
        uid=`id -u $username`&lt;br /&gt;
        gid=`id -g $username`&lt;br /&gt;
 &lt;br /&gt;
        echo -n $&amp;quot;Mounting Samba shares locally: &amp;quot;&lt;br /&gt;
        mkdir -p /mnt/samba/&lt;br /&gt;
        mkdir -p /mnt/apache/&lt;br /&gt;
        cd /mnt/apache/&lt;br /&gt;
        testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
        cd /mnt/samba/&lt;br /&gt;
        testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
        sleep 5&lt;br /&gt;
        ls -1 | while read d; do&lt;br /&gt;
                /sbin/mount.cifs &amp;quot;//127.0.0.1/$d&amp;quot; &amp;quot;$d&amp;quot; -o credentials=/home/${username}/.smb_credentials,uid=${uid},gid=${gid},file_mode=0660,dir_mode=0770,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks&lt;br /&gt;
                /sbin/mount.cifs &amp;quot;//127.0.0.1/$d&amp;quot; &amp;quot;/mnt/apache/$d&amp;quot; -o credentials=/home/${username}/.smb_credentials,uid=`id -u apache`,gid=`id -g apache`,file_mode=0777,dir_mode=0777,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks&lt;br /&gt;
        done&lt;br /&gt;
        touch /var/lock/subsys/mount_shares_locally&lt;br /&gt;
        success $&amp;quot;$base startup&amp;quot;&lt;br /&gt;
        echo&lt;br /&gt;
        return 0&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 stop () {&lt;br /&gt;
        echo -n $&amp;quot;Unmounting locally mounted Samba shares: &amp;quot;&lt;br /&gt;
        /bin/umount -l /mnt/samba/*&lt;br /&gt;
        /bin/umount -l /mnt/apache/*&lt;br /&gt;
        rm -f /var/lock/subsys/mount_shares_locally&lt;br /&gt;
        success $&amp;quot;$base shutdown&amp;quot;&lt;br /&gt;
        echo&lt;br /&gt;
        return 0&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 restart () {&lt;br /&gt;
        stop&lt;br /&gt;
        start&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 case &amp;quot;$1&amp;quot; in&lt;br /&gt;
        start)&lt;br /&gt;
                start&lt;br /&gt;
                ;;&lt;br /&gt;
        stop)&lt;br /&gt;
                stop&lt;br /&gt;
                ;;&lt;br /&gt;
        restart)&lt;br /&gt;
                restart&lt;br /&gt;
                ;;&lt;br /&gt;
        *)&lt;br /&gt;
                echo $&amp;quot;Usage: $0 {start|stop|restart}&amp;quot;&lt;br /&gt;
                exit 1&lt;br /&gt;
                ;;&lt;br /&gt;
 esac&lt;br /&gt;
 &lt;br /&gt;
 exit $?&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=72260</id>
		<title>Mount Shares Locally</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=72260"/>
		<updated>2013-08-05T07:40:47Z</updated>

		<summary type="html">&lt;p&gt;Inquam: /* Updated script for Greyhole users */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{MessageBox|&lt;br /&gt;
backgroundcolor	= #faa|&lt;br /&gt;
image	=Warning.png|&lt;br /&gt;
heading	=WARNING|&lt;br /&gt;
message = This is recommended only for advanced users, proceed with caution.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt;  Recommend not using copy and paste for the steps below.  It often introduces hidden characters which causes failure in the script.&lt;br /&gt;
&lt;br /&gt;
Mounting your Samba shares locally is useful when you are using Greyhole, and want to write or in any way work with those files locally. Greyhole data should only be accessed through shares, so mounting those shares locally is an easy way to work with Greyhole data safely.&lt;br /&gt;
&lt;br /&gt;
== Download and Setup ==&lt;br /&gt;
&lt;br /&gt;
* As '''root:''' Install the mount_shares_locally initd script:&lt;br /&gt;
=== On Ubuntu ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 sudo apt-get install cifs-utils curl&lt;br /&gt;
 sudo curl -o /etc/init.d/mount_shares_locally http://dl.amahi.org/mount_shares_locally&lt;br /&gt;
 sudo chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 sudo update-rc.d mount_shares_locally defaults&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On Fedora ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 curl -o /etc/init.d/mount_shares_locally http://dl.dropboxusercontent.com/u/3022105/Amahi/mount_shares_locally&lt;br /&gt;
 chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 chkconfig --add mount_shares_locally&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
* Edit /etc/init.d/mount_shares_locally (as user root) in a text editor, and replace ''your_username'' (on line 12) with your username. Example '''username=&amp;quot;amahi&amp;quot;'''&lt;br /&gt;
{{Code|Code= nano /etc/init.d/mount_shares_locally}}&lt;br /&gt;
* Create the ''/home/your_username/.smb_credentials'' file. This is a simple text file (use your favorite text editor).&lt;br /&gt;
{{Code|Code= nano /home/YourHDA_username/.smb_credentials}}&lt;br /&gt;
*Enter the following:&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;&amp;quot;&amp;gt;&lt;br /&gt;
 username=your_username&lt;br /&gt;
 password=your_password&lt;br /&gt;
 domain=HOME&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
'''NOTE:'''  your_username and your_password in the .smb_credentials file needs to be the original username and password you created when you installed fedora.&lt;br /&gt;
&lt;br /&gt;
*To test your new mounts, you can execute '''service mount_shares_locally start''' (as root user)&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''service mount_shares_locally stop''' (as root user) will unmount the local shares.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' If you used /etc/rc.local and /etc/fstab to mount shares locally in the past, you can remove what you added in those files now (&amp;lt;u&amp;gt;DO NOT&amp;lt;/u&amp;gt; remove the drive mount lines). The above initd script replaces all this.&lt;br /&gt;
&lt;br /&gt;
== Re-mount to Add new shares ==&lt;br /&gt;
If you added new share to greyhole via the web admin.  This does not automatically mount locally.  You need to restart your mount script by running '''service mount_shares_locally restart'''.  This will unmount and remount all your shares, adding all the new shares you added.&lt;br /&gt;
&lt;br /&gt;
== Where everything is mounted ==&lt;br /&gt;
You will find the mounted shares in ''/mnt/samba/*''&amp;lt;br/&amp;gt;&lt;br /&gt;
For example, your &amp;quot;Pictures&amp;quot; share would be located at '''/mnt/samba/Pictures'''.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt;  When working with files on the HDA, access them via this share and &amp;lt;u&amp;gt;NOT&amp;lt;/u&amp;gt; the traditional /var/hda/files/pictures location.&lt;br /&gt;
&lt;br /&gt;
== Unable to mount locally after upgrading to Amahi6 ==&lt;br /&gt;
If you try to run mount using this script after you upgraded to Amahi6 you might get greeted by this type of error.&lt;br /&gt;
&lt;br /&gt;
 [root@localhost ~]# /etc/init.d/mount_shares_locally start&lt;br /&gt;
 Mounting Samba shares locally: /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
                                                           [  OK  ]&lt;br /&gt;
&lt;br /&gt;
It's easily fixed by installing the missing dependency.&lt;br /&gt;
&lt;br /&gt;
{{Code|yum install cifs-utils}}&lt;br /&gt;
&lt;br /&gt;
Now it should work fine to run&lt;br /&gt;
&lt;br /&gt;
{{Code|/etc/init.d/mount_shares_locally start}}&lt;br /&gt;
&lt;br /&gt;
== MySQL Problems With Newer Versions of Greyhole ==&lt;br /&gt;
&lt;br /&gt;
Since Greyhole moved from SQL Lite to MySQL, you may hit a problem where Greyhole and the mount_shares_locally script both attempt to start before MySQL in bootup, leading to the services not starting properly.  If this happens, you can try this to fix it:&lt;br /&gt;
&lt;br /&gt;
{{Code|ls /etc/rc.d/rc3.d/}}&lt;br /&gt;
* Look for any entries marked S-1.  If there are any, they need to be removed.  Run the following as root:&lt;br /&gt;
&lt;br /&gt;
{{Code|rm S-1*}}&lt;br /&gt;
&lt;br /&gt;
== Updated script for Greyhole users ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some apps used by Amahi are used to download files etc. Often we want these files to end up in our shares. Let's say that SickBeard is used to download TV episodes. You then have to configure SickBeard to place your new episode somewhere. A logical place is to save to the landing zone of your Greyhole share which could be ''/var/hda/files/TV''. There are two downsides to this though.&lt;br /&gt;
&lt;br /&gt;
* Greyhole is not notified of the fact that a file is added and only discovers it and makes it available in your share after a ''fsck'', which could take a long time.&lt;br /&gt;
* Files deleted through apps in this folder don't register a ''delete'' event that Greyhole can pick up and thus only the symlink in the landing zone is removed. The actual file copies remain on disc. Similarly users running Plex Media Server for example will have issues if the clients are allowed to ''delete contents'' and the server is configured to work on the landing zone. I described this issue when packaging Plex a long time ago here: https://wiki.amahi.org/index.php/Plex_Media_Server&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since Greyhole uses Samba as a layer between the user and itself we would like to keep our writes and deletes to the shares and not the actual landing zone. But since apps (most of them) run as the users ''apache'' it will not be able to access ''/mnt/samba'' which is the default mount point if you set up ''mount_shares_locally''. This following script retains the function of the original script but also adds a second mount point under ''/mnt/apache'' where the ''apache'' user will have read and write access. I have kept it simple and it will use the same credentials as the ''main'' mount. So only shares available to that user will ea available for apache.&lt;br /&gt;
&lt;br /&gt;
By doing this apache will now have a place where it is allowed to read and write files to your shares and SickBeard can thus be configured to place the new episode in ''/mnt/apache/TV'' which is the instantly picked up by Greyhole and file copies distributed to the discs in your pool as configured.&lt;br /&gt;
&lt;br /&gt;
Note that this script is based of the Greyhole original one and uses ''/etc/samba/smb.conf'' as the source of your shares and does not load the shares from the database like the old HDA version of the script did. If that behaviour is desired that can be easily added by replacing the lines&lt;br /&gt;
&lt;br /&gt;
 testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
 mysql -u root -phda -e &amp;quot;select comment from shares&amp;quot; hda_production | grep -v &amp;quot;^comment$&amp;quot; | xargs -d &amp;quot;\n&amp;quot; mkdir -p &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ### BEGIN INIT INFO&lt;br /&gt;
 # Provides:          mount_shares_locally&lt;br /&gt;
 # Required-Start:    $network $local_fs $remote_fs smb mysqld&lt;br /&gt;
 # Required-Stop:     $network $local_fs $remote_fs smb&lt;br /&gt;
 # Default-Start:     2 3 4 5&lt;br /&gt;
 # Default-Stop:      0 1 6&lt;br /&gt;
 # Short-Description: mount Samba shares locally&lt;br /&gt;
 ### END INIT INFO&lt;br /&gt;
 &lt;br /&gt;
 username=&amp;quot;YOURUSERHERE&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 if [ -f /etc/rc.d/init.d/functions ]; then&lt;br /&gt;
        . /etc/rc.d/init.d/functions&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 start () {&lt;br /&gt;
        uid=`id -u $username`&lt;br /&gt;
        gid=`id -g $username`&lt;br /&gt;
 &lt;br /&gt;
        echo -n $&amp;quot;Mounting Samba shares locally: &amp;quot;&lt;br /&gt;
        mkdir -p /mnt/samba/&lt;br /&gt;
        mkdir -p /mnt/apache/&lt;br /&gt;
        cd /mnt/apache/&lt;br /&gt;
        testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
        cd /mnt/samba/&lt;br /&gt;
        testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
        sleep 5&lt;br /&gt;
        ls -1 | while read d; do&lt;br /&gt;
                /sbin/mount.cifs &amp;quot;//127.0.0.1/$d&amp;quot; &amp;quot;$d&amp;quot; -o credentials=/home/${username}/.smb_credentials,uid=${uid},gid=${gid},file_mode=0660,dir_mode=0770,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks&lt;br /&gt;
                /sbin/mount.cifs &amp;quot;//127.0.0.1/$d&amp;quot; &amp;quot;/mnt/apache/$d&amp;quot; -o credentials=/home/${username}/.smb_credentials,uid=`id -u apache`,gid=`id -g apache`,file_mode=0777,dir_mode=0777,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks&lt;br /&gt;
        done&lt;br /&gt;
        touch /var/lock/subsys/mount_shares_locally&lt;br /&gt;
        success $&amp;quot;$base startup&amp;quot;&lt;br /&gt;
        echo&lt;br /&gt;
        return 0&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 stop () {&lt;br /&gt;
        echo -n $&amp;quot;Unmounting locally mounted Samba shares: &amp;quot;&lt;br /&gt;
        /bin/umount -l /mnt/samba/*&lt;br /&gt;
        /bin/umount -l /mnt/apache/*&lt;br /&gt;
        rm -f /var/lock/subsys/mount_shares_locally&lt;br /&gt;
        success $&amp;quot;$base shutdown&amp;quot;&lt;br /&gt;
        echo&lt;br /&gt;
        return 0&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 restart () {&lt;br /&gt;
        stop&lt;br /&gt;
        start&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 case &amp;quot;$1&amp;quot; in&lt;br /&gt;
        start)&lt;br /&gt;
                start&lt;br /&gt;
                ;;&lt;br /&gt;
        stop)&lt;br /&gt;
                stop&lt;br /&gt;
                ;;&lt;br /&gt;
        restart)&lt;br /&gt;
                restart&lt;br /&gt;
                ;;&lt;br /&gt;
        *)&lt;br /&gt;
                echo $&amp;quot;Usage: $0 {start|stop|restart}&amp;quot;&lt;br /&gt;
                exit 1&lt;br /&gt;
                ;;&lt;br /&gt;
 esac&lt;br /&gt;
 &lt;br /&gt;
 exit $?&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=72254</id>
		<title>Mount Shares Locally</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=72254"/>
		<updated>2013-08-05T07:37:57Z</updated>

		<summary type="html">&lt;p&gt;Inquam: Added description of an updated version of the script to allow apache to write to locally mounted shares to facilitate easier use for apps&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{MessageBox|&lt;br /&gt;
backgroundcolor	= #faa|&lt;br /&gt;
image	=Warning.png|&lt;br /&gt;
heading	=WARNING|&lt;br /&gt;
message = This is recommended only for advanced users, proceed with caution.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt;  Recommend not using copy and paste for the steps below.  It often introduces hidden characters which causes failure in the script.&lt;br /&gt;
&lt;br /&gt;
Mounting your Samba shares locally is useful when you are using Greyhole, and want to write or in any way work with those files locally. Greyhole data should only be accessed through shares, so mounting those shares locally is an easy way to work with Greyhole data safely.&lt;br /&gt;
&lt;br /&gt;
== Download and Setup ==&lt;br /&gt;
&lt;br /&gt;
* As '''root:''' Install the mount_shares_locally initd script:&lt;br /&gt;
=== On Ubuntu ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 sudo apt-get install cifs-utils curl&lt;br /&gt;
 sudo curl -o /etc/init.d/mount_shares_locally http://dl.amahi.org/mount_shares_locally&lt;br /&gt;
 sudo chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 sudo update-rc.d mount_shares_locally defaults&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On Fedora ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 curl -o /etc/init.d/mount_shares_locally http://dl.dropboxusercontent.com/u/3022105/Amahi/mount_shares_locally&lt;br /&gt;
 chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 chkconfig --add mount_shares_locally&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
* Edit /etc/init.d/mount_shares_locally (as user root) in a text editor, and replace ''your_username'' (on line 12) with your username. Example '''username=&amp;quot;amahi&amp;quot;'''&lt;br /&gt;
{{Code|Code= nano /etc/init.d/mount_shares_locally}}&lt;br /&gt;
* Create the ''/home/your_username/.smb_credentials'' file. This is a simple text file (use your favorite text editor).&lt;br /&gt;
{{Code|Code= nano /home/YourHDA_username/.smb_credentials}}&lt;br /&gt;
*Enter the following:&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;&amp;quot;&amp;gt;&lt;br /&gt;
 username=your_username&lt;br /&gt;
 password=your_password&lt;br /&gt;
 domain=HOME&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
'''NOTE:'''  your_username and your_password in the .smb_credentials file needs to be the original username and password you created when you installed fedora.&lt;br /&gt;
&lt;br /&gt;
*To test your new mounts, you can execute '''service mount_shares_locally start''' (as root user)&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''service mount_shares_locally stop''' (as root user) will unmount the local shares.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' If you used /etc/rc.local and /etc/fstab to mount shares locally in the past, you can remove what you added in those files now (&amp;lt;u&amp;gt;DO NOT&amp;lt;/u&amp;gt; remove the drive mount lines). The above initd script replaces all this.&lt;br /&gt;
&lt;br /&gt;
== Re-mount to Add new shares ==&lt;br /&gt;
If you added new share to greyhole via the web admin.  This does not automatically mount locally.  You need to restart your mount script by running '''service mount_shares_locally restart'''.  This will unmount and remount all your shares, adding all the new shares you added.&lt;br /&gt;
&lt;br /&gt;
== Where everything is mounted ==&lt;br /&gt;
You will find the mounted shares in ''/mnt/samba/*''&amp;lt;br/&amp;gt;&lt;br /&gt;
For example, your &amp;quot;Pictures&amp;quot; share would be located at '''/mnt/samba/Pictures'''.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt;  When working with files on the HDA, access them via this share and &amp;lt;u&amp;gt;NOT&amp;lt;/u&amp;gt; the traditional /var/hda/files/pictures location.&lt;br /&gt;
&lt;br /&gt;
== Unable to mount locally after upgrading to Amahi6 ==&lt;br /&gt;
If you try to run mount using this script after you upgraded to Amahi6 you might get greeted by this type of error.&lt;br /&gt;
&lt;br /&gt;
 [root@localhost ~]# /etc/init.d/mount_shares_locally start&lt;br /&gt;
 Mounting Samba shares locally: /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
                                                           [  OK  ]&lt;br /&gt;
&lt;br /&gt;
It's easily fixed by installing the missing dependency.&lt;br /&gt;
&lt;br /&gt;
{{Code|yum install cifs-utils}}&lt;br /&gt;
&lt;br /&gt;
Now it should work fine to run&lt;br /&gt;
&lt;br /&gt;
{{Code|/etc/init.d/mount_shares_locally start}}&lt;br /&gt;
&lt;br /&gt;
== MySQL Problems With Newer Versions of Greyhole ==&lt;br /&gt;
&lt;br /&gt;
Since Greyhole moved from SQL Lite to MySQL, you may hit a problem where Greyhole and the mount_shares_locally script both attempt to start before MySQL in bootup, leading to the services not starting properly.  If this happens, you can try this to fix it:&lt;br /&gt;
&lt;br /&gt;
{{Code|ls /etc/rc.d/rc3.d/}}&lt;br /&gt;
* Look for any entries marked S-1.  If there are any, they need to be removed.  Run the following as root:&lt;br /&gt;
&lt;br /&gt;
{{Code|rm S-1*}}&lt;br /&gt;
&lt;br /&gt;
== Updated script for Greyhole users ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some apps used by Amahi are used to download files etc. Often we want these files to end up in our shares. Let's say that SickBeard is used to download TV episodes. You then have to configure SickBeard to place your new episode somewhere. A logical place is to save to the landing zone of your Greyhole share which could be ''/var/hda/files/TV''. There are two downsides to this though.&lt;br /&gt;
&lt;br /&gt;
* Greyhole is not notified of the fact that a file is added and only discovers it and makes it available in your share after a ''fsck''&lt;br /&gt;
* Files deleted through apps in this folder don't register a ''delete'' event that Greyhole can pick up and thus only the symlink in the landing zone is removed. The actual file copies remain in disc. Similarly users running Plex Media Server for example will have issues if the clients are allowed to ''delete contents'' and the server is configured to work on the landing zone. I described this issue when packaging Plex a long time ago here: https://wiki.amahi.org/index.php/Plex_Media_Server&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since Greyhole uses Samba as a layer between the user and itself we would like to keep our writes and deletes to the shares and not the actual landing zone. But since apps (most of them) run as the users ''apache'' it will not be able to access ''/mnt/samba'' which is the default mount point if you set up ''mount_shares_locally''. This following script retains the function of the original script but also adds a second mount point under ''/mnt/apache'' where the ''apache'' user will have read and write access. I have kept it simple and it will use the same credentials as the ''main'' mount. So only shares available to that user will ea available for apache.&lt;br /&gt;
&lt;br /&gt;
By doing this apache will now have a place where it is allowed to read and write files to your shares and SickBeard can thus be configured to place the new episode in ''/mnt/apache/TV'' which is the instantly picked up by Greyhole and file copies distributed to the discs in your pool as configured.&lt;br /&gt;
&lt;br /&gt;
Note that this script is based of the Greyhole original one and uses ''/etc/samba/smb.conf'' as the source of your shares and does not load the shares from the database like the old HDA version of the script did. If that behaviour is desired that can be easily added by replacing the lines&lt;br /&gt;
&lt;br /&gt;
 testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
 mysql -u root -phda -e &amp;quot;select comment from shares&amp;quot; hda_production | grep -v &amp;quot;^comment$&amp;quot; | xargs -d &amp;quot;\n&amp;quot; mkdir -p &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ### BEGIN INIT INFO&lt;br /&gt;
 # Provides:          mount_shares_locally&lt;br /&gt;
 # Required-Start:    $network $local_fs $remote_fs smb mysqld&lt;br /&gt;
 # Required-Stop:     $network $local_fs $remote_fs smb&lt;br /&gt;
 # Default-Start:     2 3 4 5&lt;br /&gt;
 # Default-Stop:      0 1 6&lt;br /&gt;
 # Short-Description: mount Samba shares locally&lt;br /&gt;
 ### END INIT INFO&lt;br /&gt;
 &lt;br /&gt;
 username=&amp;quot;YOURUSERHERE&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 if [ -f /etc/rc.d/init.d/functions ]; then&lt;br /&gt;
        . /etc/rc.d/init.d/functions&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 start () {&lt;br /&gt;
        uid=`id -u $username`&lt;br /&gt;
        gid=`id -g $username`&lt;br /&gt;
 &lt;br /&gt;
        echo -n $&amp;quot;Mounting Samba shares locally: &amp;quot;&lt;br /&gt;
        mkdir -p /mnt/samba/&lt;br /&gt;
        mkdir -p /mnt/apache/&lt;br /&gt;
        cd /mnt/apache/&lt;br /&gt;
        testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
        cd /mnt/samba/&lt;br /&gt;
        testparm -s /etc/samba/smb.conf 2&amp;gt;/dev/null | grep &amp;quot;^\[&amp;quot; | grep -v &amp;quot;\[global\]&amp;quot; | grep -v &amp;quot;\[homes\]&amp;quot; | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d &amp;quot;\n&amp;quot; mkdir -p&lt;br /&gt;
        sleep 5&lt;br /&gt;
        ls -1 | while read d; do&lt;br /&gt;
                /sbin/mount.cifs &amp;quot;//127.0.0.1/$d&amp;quot; &amp;quot;$d&amp;quot; -o credentials=/home/${username}/.smb_credentials,uid=${uid},gid=${gid},file_mode=0660,dir_mode=0770,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks&lt;br /&gt;
                /sbin/mount.cifs &amp;quot;//127.0.0.1/$d&amp;quot; &amp;quot;/mnt/apache/$d&amp;quot; -o credentials=/home/${username}/.smb_credentials,uid=`id -u apache`,gid=`id -g apache`,file_mode=0777,dir_mode=0777,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks&lt;br /&gt;
        done&lt;br /&gt;
        touch /var/lock/subsys/mount_shares_locally&lt;br /&gt;
        success $&amp;quot;$base startup&amp;quot;&lt;br /&gt;
        echo&lt;br /&gt;
        return 0&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 stop () {&lt;br /&gt;
        echo -n $&amp;quot;Unmounting locally mounted Samba shares: &amp;quot;&lt;br /&gt;
        /bin/umount -l /mnt/samba/*&lt;br /&gt;
        /bin/umount -l /mnt/apache/*&lt;br /&gt;
        rm -f /var/lock/subsys/mount_shares_locally&lt;br /&gt;
        success $&amp;quot;$base shutdown&amp;quot;&lt;br /&gt;
        echo&lt;br /&gt;
        return 0&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 restart () {&lt;br /&gt;
        stop&lt;br /&gt;
        start&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 case &amp;quot;$1&amp;quot; in&lt;br /&gt;
        start)&lt;br /&gt;
                start&lt;br /&gt;
                ;;&lt;br /&gt;
        stop)&lt;br /&gt;
                stop&lt;br /&gt;
                ;;&lt;br /&gt;
        restart)&lt;br /&gt;
                restart&lt;br /&gt;
                ;;&lt;br /&gt;
        *)&lt;br /&gt;
                echo $&amp;quot;Usage: $0 {start|stop|restart}&amp;quot;&lt;br /&gt;
                exit 1&lt;br /&gt;
                ;;&lt;br /&gt;
 esac&lt;br /&gt;
 &lt;br /&gt;
 exit $?&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=File:Plex_media_server_screenshot_320x240.png&amp;diff=45919</id>
		<title>File:Plex media server screenshot 320x240.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=File:Plex_media_server_screenshot_320x240.png&amp;diff=45919"/>
		<updated>2011-08-26T08:16:10Z</updated>

		<summary type="html">&lt;p&gt;Inquam: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=File:Plex_media_server_logo_160x120.png&amp;diff=45913</id>
		<title>File:Plex media server logo 160x120.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=File:Plex_media_server_logo_160x120.png&amp;diff=45913"/>
		<updated>2011-08-26T08:15:12Z</updated>

		<summary type="html">&lt;p&gt;Inquam: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=File:Plex-Interface.png&amp;diff=45679</id>
		<title>File:Plex-Interface.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=File:Plex-Interface.png&amp;diff=45679"/>
		<updated>2011-08-22T08:46:22Z</updated>

		<summary type="html">&lt;p&gt;Inquam: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=File:Plex-Logo.gif&amp;diff=45673</id>
		<title>File:Plex-Logo.gif</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=File:Plex-Logo.gif&amp;diff=45673"/>
		<updated>2011-08-22T08:42:06Z</updated>

		<summary type="html">&lt;p&gt;Inquam: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Make_Samba_Go_Faster&amp;diff=44641</id>
		<title>Make Samba Go Faster</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Make_Samba_Go_Faster&amp;diff=44641"/>
		<updated>2011-08-11T11:34:12Z</updated>

		<summary type="html">&lt;p&gt;Inquam: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{MessageBox|&lt;br /&gt;
backgroundcolor	= red|&lt;br /&gt;
image	=Warning.png|&lt;br /&gt;
heading	=WARNING|&lt;br /&gt;
message = This is recommended only for advanced users, proceed with caution.}}&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
Amahi makes heavy use of Samba. Samba is what handles shared folders and allow you to connect to your Amahi and browse your folders from Windows etc.&lt;br /&gt;
Greyhole also uses Samba and it's logs to handle file operations.&lt;br /&gt;
&lt;br /&gt;
After installing a wired gigabit network in my house, due to the WIFI being bogged down by 14 wireless clients, I tested the performance in the network. I got around 500-600MBit/sec in read speeds and about 600-700MBit/sec in write speeds. But when I tried against the Amahi server I found that I only got 56MBit/sec in read speeds.&lt;br /&gt;
&lt;br /&gt;
After looking at the samba configuration file I saw that Async IO ('''AIO''') was not enabled by Amahi. What AIO does is that it let's Samba handle several file operations asynchronously. This can, at the expense of some CPU cycles, increase the performance quite a lot.&lt;br /&gt;
&lt;br /&gt;
I increased the read speed to 500-600MBit/sec by enabling AIO and saw Samba using around 1-4% CPU on a Intel E2200.&lt;br /&gt;
&lt;br /&gt;
==Enable AIO==&lt;br /&gt;
&lt;br /&gt;
To enable AIO an you can add the following to the '''global''' section of your '''/etc/samba/smb.conf''' file&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=&lt;br /&gt;
socket options=SO_RCVBUF=131072 SO_SNDBUF=131072 TCP_NODELAY&lt;br /&gt;
min receivefile size = 16384&lt;br /&gt;
use sendfile = true&lt;br /&gt;
aio read size = 16384&lt;br /&gt;
aio write size = 16384&lt;br /&gt;
aio write behind = true &amp;lt;--- NOTE!!!: Only use with extreme caution. Read explanation bellow&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is only an example but you can tweak all the options to fit your environment and needs. Bellow are an explination of the options used above. More information can be found at http://www.samba.org&lt;br /&gt;
&lt;br /&gt;
==Options Explained==&lt;br /&gt;
&lt;br /&gt;
===min receivefile size===&lt;br /&gt;
This option changes the behavior of Samba when processing SMBwriteX calls. Any incoming SMBwriteX call on a non-signed SMB/CIFS connection greater than this value will not be processed in the normal way but will be passed to any underlying kernel recvfile or splice system call (if there is no such call Samba will emulate in user space). This allows zero-copy writes directly from network socket buffers into the filesystem buffer cache, if available. It may improve performance but user testing is recommended. If set to zero Samba processes SMBwriteX calls in the normal way. To enable POSIX large write support (SMB/CIFS writes up to 16Mb) this option must be nonzero. The maximum value is 128k. Values greater than 128k will be silently set to 128k.&lt;br /&gt;
&lt;br /&gt;
    Note this option will have NO EFFECT if set on a SMB signed connection.&lt;br /&gt;
&lt;br /&gt;
    The default is zero, which disables this option&lt;br /&gt;
&lt;br /&gt;
===use sendfile===&lt;br /&gt;
If this parameter is yes, and the sendfile() system call is supported by the underlying operating system, then some SMB read calls (mainly ReadAndX and ReadRaw) will use the more efficient sendfile system call for files that are exclusively oplocked. This may make more efficient use of the system CPU's and cause Samba to be faster. Samba automatically turns this off for clients that use protocol levels lower than NT LM 0.12 and when it detects a client is Windows 9x (using sendfile from Linux will cause these clients to fail). &lt;br /&gt;
&lt;br /&gt;
===socket options===&lt;br /&gt;
This option allows you to set socket options to be used when talking with the client.&lt;br /&gt;
&lt;br /&gt;
Socket options are controls on the networking layer of the operating systems which allow the connection to be tuned.&lt;br /&gt;
&lt;br /&gt;
This option will typically be used to tune your Samba server for optimal performance for your local network. There is no way that Samba can know what the optimal parameters are for your net, so you must experiment and choose them yourself. We strongly suggest you read the appropriate documentation for your operating system first (perhaps man setsockopt will help).&lt;br /&gt;
&lt;br /&gt;
You may find that on some systems Samba will say &amp;quot;Unknown socket option&amp;quot; when you supply an option. This means you either incorrectly typed it or you need to add an include file to includes.h for your OS. If the latter is the case please send the patch to samba-technical@samba.org.&lt;br /&gt;
&lt;br /&gt;
Any of the supported socket options may be combined in any way you like, as long as your OS allows it.&lt;br /&gt;
&lt;br /&gt;
This is the list of socket options currently settable using this option:&lt;br /&gt;
&lt;br /&gt;
* SO_KEEPALIVE&lt;br /&gt;
* SO_REUSEADDR&lt;br /&gt;
* SO_BROADCAST&lt;br /&gt;
* TCP_NODELAY&lt;br /&gt;
* IPTOS_LOWDELAY&lt;br /&gt;
* IPTOS_THROUGHPUT&lt;br /&gt;
* SO_SNDBUF *&lt;br /&gt;
* SO_RCVBUF *&lt;br /&gt;
* SO_SNDLOWAT *&lt;br /&gt;
* SO_RCVLOWAT *&lt;br /&gt;
&lt;br /&gt;
''Those marked with a '*' take an integer argument. The others can optionally take a 1 or 0 argument to enable or disable the option, by default they will be enabled if you don't specify 1 or 0.''&lt;br /&gt;
&lt;br /&gt;
To specify an argument use the syntax SOME_OPTION = VALUE for example SO_SNDBUF = 8192. Note that you must not have any spaces before or after the = sign.&lt;br /&gt;
&lt;br /&gt;
If you are on a local network then a sensible option might be:&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=socket options = IPTOS_LOWDELAY}}&lt;br /&gt;
&lt;br /&gt;
If you have a local network then you could try:&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=socket options = IPTOS_LOWDELAY TCP_NODELAY}}&lt;br /&gt;
&lt;br /&gt;
If you are on a wide area network then perhaps try setting IPTOS_THROUGHPUT.&lt;br /&gt;
&lt;br /&gt;
Note that several of the options may cause your Samba server to fail completely. '''Use these options with caution!'''&lt;br /&gt;
&lt;br /&gt;
===aio read size===&lt;br /&gt;
Samba will read from file asynchronously when size of request is bigger than this value. Note that it happens only for non-chained and non-chaining reads and when not using write cache.&lt;br /&gt;
&lt;br /&gt;
===aio write size===&lt;br /&gt;
Samba will write to file asynchronously when size of request is bigger than this value. Note that it happens only for non-chained and non-chaining reads and when not using write cache.&lt;br /&gt;
&lt;br /&gt;
===aio write behind===&lt;br /&gt;
Samba will not wait until write requests are finished before returning the result to the client for files listed in this parameter. Instead, Samba will immediately return that the write request has been finished successfully, no matter if the operation will succeed or not. This might speed up clients without aio support, but is really dangerous, because data could be lost and files could be damaged.&lt;br /&gt;
&lt;br /&gt;
==Things to Note==&lt;br /&gt;
'''It can not be under stressed. Bad options can be very BAD. It can corrupt your data and make you very sad. Use extreme caution if experimenting with the options!'''&lt;br /&gt;
&lt;br /&gt;
If you add a new share in Amahi or change the settings of an existing one, Amahi will overwrite the '''/etc/samba/smb.conf''' file with the new configuration and thus removing your changes. A place to enable '''AIO''' in the settings section of Amahi has been suggested at http://bugs.amahi.org/issues/show/861&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Make_Samba_Go_Faster&amp;diff=44635</id>
		<title>Make Samba Go Faster</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Make_Samba_Go_Faster&amp;diff=44635"/>
		<updated>2011-08-11T11:26:39Z</updated>

		<summary type="html">&lt;p&gt;Inquam: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{MessageBox|&lt;br /&gt;
backgroundcolor	= red|&lt;br /&gt;
image	=Warning.png|&lt;br /&gt;
heading	=WARNING|&lt;br /&gt;
message = This is recommended only for advanced users, proceed with caution.}}&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
Amahi makes heavy use of Samba. Samba is what handles shared folders and allow you to connect to your Amahi and browse your folders from Windows etc.&lt;br /&gt;
Greyhole also uses Samba and it's logs to handle file operations.&lt;br /&gt;
&lt;br /&gt;
After installing a wired gigabit network in my house, due to the WIFI being bogged down by 14 wireless clients, I tested the performance in the network. I got around 500-600MBit/sec in read speeds and about 600-700MBit/sec in write speeds. But when I tried against the Amahi server I found that I only got 56MBit/sec in read speeds.&lt;br /&gt;
&lt;br /&gt;
After looking at the samba configuration file I saw that Async IO ('''AIO''') was not enabled by Amahi. What AIO does is that it let's Samba handle several file operations asynchronously. This can, at the expense of some CPU cycles, increase the performance quite a lot.&lt;br /&gt;
&lt;br /&gt;
I increased the read speed to 500-600MBit/sec by enabling AIO and saw Samba using around 1-4% CPU on a Intel E2200.&lt;br /&gt;
&lt;br /&gt;
==Enable AIO==&lt;br /&gt;
&lt;br /&gt;
To enable AIO an you can add the following to the '''global''' section of your '''/etc/samba/smb.conf''' file&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=&lt;br /&gt;
socket options=SO_RCVBUF=131072 SO_SNDBUF=131072 TCP_NODELAY&lt;br /&gt;
min receivefile size = 16384&lt;br /&gt;
use sendfile = true&lt;br /&gt;
aio read size = 16384&lt;br /&gt;
aio write size = 16384&lt;br /&gt;
aio write behind = true &amp;lt;--- NOTE!!!: Only use with extreme caution. Read explanation bellow&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is only an example but you can tweak all the options to fit your environment and needs. Bellow are an explination of the options used above. More information can be found at http://www.samba.org&lt;br /&gt;
&lt;br /&gt;
==Options Explained==&lt;br /&gt;
&lt;br /&gt;
===min receivefile size===&lt;br /&gt;
This option changes the behavior of Samba when processing SMBwriteX calls. Any incoming SMBwriteX call on a non-signed SMB/CIFS connection greater than this value will not be processed in the normal way but will be passed to any underlying kernel recvfile or splice system call (if there is no such call Samba will emulate in user space). This allows zero-copy writes directly from network socket buffers into the filesystem buffer cache, if available. It may improve performance but user testing is recommended. If set to zero Samba processes SMBwriteX calls in the normal way. To enable POSIX large write support (SMB/CIFS writes up to 16Mb) this option must be nonzero. The maximum value is 128k. Values greater than 128k will be silently set to 128k.&lt;br /&gt;
&lt;br /&gt;
    Note this option will have NO EFFECT if set on a SMB signed connection.&lt;br /&gt;
&lt;br /&gt;
    The default is zero, which disables this option&lt;br /&gt;
&lt;br /&gt;
===use sendfile===&lt;br /&gt;
If this parameter is yes, and the sendfile() system call is supported by the underlying operating system, then some SMB read calls (mainly ReadAndX and ReadRaw) will use the more efficient sendfile system call for files that are exclusively oplocked. This may make more efficient use of the system CPU's and cause Samba to be faster. Samba automatically turns this off for clients that use protocol levels lower than NT LM 0.12 and when it detects a client is Windows 9x (using sendfile from Linux will cause these clients to fail). &lt;br /&gt;
&lt;br /&gt;
===socket options===&lt;br /&gt;
This option allows you to set socket options to be used when talking with the client.&lt;br /&gt;
&lt;br /&gt;
Socket options are controls on the networking layer of the operating systems which allow the connection to be tuned.&lt;br /&gt;
&lt;br /&gt;
This option will typically be used to tune your Samba server for optimal performance for your local network. There is no way that Samba can know what the optimal parameters are for your net, so you must experiment and choose them yourself. We strongly suggest you read the appropriate documentation for your operating system first (perhaps man setsockopt will help).&lt;br /&gt;
&lt;br /&gt;
You may find that on some systems Samba will say &amp;quot;Unknown socket option&amp;quot; when you supply an option. This means you either incorrectly typed it or you need to add an include file to includes.h for your OS. If the latter is the case please send the patch to samba-technical@samba.org.&lt;br /&gt;
&lt;br /&gt;
Any of the supported socket options may be combined in any way you like, as long as your OS allows it.&lt;br /&gt;
&lt;br /&gt;
This is the list of socket options currently settable using this option:&lt;br /&gt;
&lt;br /&gt;
* SO_KEEPALIVE&lt;br /&gt;
* SO_REUSEADDR&lt;br /&gt;
* SO_BROADCAST&lt;br /&gt;
* TCP_NODELAY&lt;br /&gt;
* IPTOS_LOWDELAY&lt;br /&gt;
* IPTOS_THROUGHPUT&lt;br /&gt;
* SO_SNDBUF *&lt;br /&gt;
* SO_RCVBUF *&lt;br /&gt;
* SO_SNDLOWAT *&lt;br /&gt;
* SO_RCVLOWAT *&lt;br /&gt;
&lt;br /&gt;
''Those marked with a '*' take an integer argument. The others can optionally take a 1 or 0 argument to enable or disable the option, by default they will be enabled if you don't specify 1 or 0.''&lt;br /&gt;
&lt;br /&gt;
To specify an argument use the syntax SOME_OPTION = VALUE for example SO_SNDBUF = 8192. Note that you must not have any spaces before or after the = sign.&lt;br /&gt;
&lt;br /&gt;
If you are on a local network then a sensible option might be:&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=socket options = IPTOS_LOWDELAY}}&lt;br /&gt;
&lt;br /&gt;
If you have a local network then you could try:&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=socket options = IPTOS_LOWDELAY TCP_NODELAY}}&lt;br /&gt;
&lt;br /&gt;
If you are on a wide area network then perhaps try setting IPTOS_THROUGHPUT.&lt;br /&gt;
&lt;br /&gt;
Note that several of the options may cause your Samba server to fail completely. '''Use these options with caution!'''&lt;br /&gt;
&lt;br /&gt;
===aio read size===&lt;br /&gt;
Samba will read from file asynchronously when size of request is bigger than this value. Note that it happens only for non-chained and non-chaining reads and when not using write cache.&lt;br /&gt;
&lt;br /&gt;
===aio write size===&lt;br /&gt;
Samba will write to file asynchronously when size of request is bigger than this value. Note that it happens only for non-chained and non-chaining reads and when not using write cache.&lt;br /&gt;
&lt;br /&gt;
===aio write behind===&lt;br /&gt;
Samba will not wait until write requests are finished before returning the result to the client for files listed in this parameter. Instead, Samba will immediately return that the write request has been finished successfully, no matter if the operation will succeed or not. This might speed up clients without aio support, but is really dangerous, because data could be lost and files could be damaged.&lt;br /&gt;
&lt;br /&gt;
==Things to Note==&lt;br /&gt;
'''It can not be under stressed. Bad options can be very BAD. It can corrupt your data and make you very sad. Use extreme caution if elaborating with the options!'''&lt;br /&gt;
&lt;br /&gt;
If you add a new share in Amahi or change the settings of an existing one, Amahi will overwrite the '''/etc/samba/smb.conf''' file with the new configuration and thus removing your changes. A place to enable '''AIO''' in the settings section of Amahi has been suggested at http://bugs.amahi.org/issues/show/861&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Make_Samba_Go_Faster&amp;diff=44629</id>
		<title>Make Samba Go Faster</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Make_Samba_Go_Faster&amp;diff=44629"/>
		<updated>2011-08-11T11:25:26Z</updated>

		<summary type="html">&lt;p&gt;Inquam: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{MessageBox|&lt;br /&gt;
backgroundcolor	= red|&lt;br /&gt;
image	=Warning.png|&lt;br /&gt;
heading	=WARNING|&lt;br /&gt;
message = This is recommended only for advanced users, proceed with caution.}}&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
Amahi makes heavy use of Samba. Samba is what handles shared folders and allow you to connect to your Amahi and browse your folders from Windows etc.&lt;br /&gt;
Greyhole also uses Samba and it's logs to handle file operations.&lt;br /&gt;
&lt;br /&gt;
After installing a wired gigabit network in my house, due to the WIFI being bogged down by 14 wireless clients, I tested the performance in the network. I got around 500-600MBit/sec in read speeds and about 600-700MBit/sec in write speeds. But when I tried against the Amahi server I found that I only got 56MBit/sec in read speeds.&lt;br /&gt;
&lt;br /&gt;
After looking at the samba configuration file I saw that Async IO ('''AIO''') was not enabled by Amahi. What AIO does is that it let's Samba create multiple threads to handle file operations. This can, at the expense of some CPU cycles, increase the performance quite a lot.&lt;br /&gt;
&lt;br /&gt;
I increased the read speed to 500-600MBit/sec by enabling AIO and saw Samba using around 1-4% CPU on a Intel E2200.&lt;br /&gt;
&lt;br /&gt;
==Enable AIO==&lt;br /&gt;
&lt;br /&gt;
To enable AIO an you can add the following to the '''global''' section of your '''/etc/samba/smb.conf''' file&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=&lt;br /&gt;
socket options=SO_RCVBUF=131072 SO_SNDBUF=131072 TCP_NODELAY&lt;br /&gt;
min receivefile size = 16384&lt;br /&gt;
use sendfile = true&lt;br /&gt;
aio read size = 16384&lt;br /&gt;
aio write size = 16384&lt;br /&gt;
aio write behind = true &amp;lt;--- NOTE!!!: Only use with extreme caution. Read explanation bellow&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is only an example but you can tweak all the options to fit your environment and needs. Bellow are an explination of the options used above. More information can be found at http://www.samba.org&lt;br /&gt;
&lt;br /&gt;
==Options Explained==&lt;br /&gt;
&lt;br /&gt;
===min receivefile size===&lt;br /&gt;
This option changes the behavior of Samba when processing SMBwriteX calls. Any incoming SMBwriteX call on a non-signed SMB/CIFS connection greater than this value will not be processed in the normal way but will be passed to any underlying kernel recvfile or splice system call (if there is no such call Samba will emulate in user space). This allows zero-copy writes directly from network socket buffers into the filesystem buffer cache, if available. It may improve performance but user testing is recommended. If set to zero Samba processes SMBwriteX calls in the normal way. To enable POSIX large write support (SMB/CIFS writes up to 16Mb) this option must be nonzero. The maximum value is 128k. Values greater than 128k will be silently set to 128k.&lt;br /&gt;
&lt;br /&gt;
    Note this option will have NO EFFECT if set on a SMB signed connection.&lt;br /&gt;
&lt;br /&gt;
    The default is zero, which disables this option&lt;br /&gt;
&lt;br /&gt;
===use sendfile===&lt;br /&gt;
If this parameter is yes, and the sendfile() system call is supported by the underlying operating system, then some SMB read calls (mainly ReadAndX and ReadRaw) will use the more efficient sendfile system call for files that are exclusively oplocked. This may make more efficient use of the system CPU's and cause Samba to be faster. Samba automatically turns this off for clients that use protocol levels lower than NT LM 0.12 and when it detects a client is Windows 9x (using sendfile from Linux will cause these clients to fail). &lt;br /&gt;
&lt;br /&gt;
===socket options===&lt;br /&gt;
This option allows you to set socket options to be used when talking with the client.&lt;br /&gt;
&lt;br /&gt;
Socket options are controls on the networking layer of the operating systems which allow the connection to be tuned.&lt;br /&gt;
&lt;br /&gt;
This option will typically be used to tune your Samba server for optimal performance for your local network. There is no way that Samba can know what the optimal parameters are for your net, so you must experiment and choose them yourself. We strongly suggest you read the appropriate documentation for your operating system first (perhaps man setsockopt will help).&lt;br /&gt;
&lt;br /&gt;
You may find that on some systems Samba will say &amp;quot;Unknown socket option&amp;quot; when you supply an option. This means you either incorrectly typed it or you need to add an include file to includes.h for your OS. If the latter is the case please send the patch to samba-technical@samba.org.&lt;br /&gt;
&lt;br /&gt;
Any of the supported socket options may be combined in any way you like, as long as your OS allows it.&lt;br /&gt;
&lt;br /&gt;
This is the list of socket options currently settable using this option:&lt;br /&gt;
&lt;br /&gt;
* SO_KEEPALIVE&lt;br /&gt;
* SO_REUSEADDR&lt;br /&gt;
* SO_BROADCAST&lt;br /&gt;
* TCP_NODELAY&lt;br /&gt;
* IPTOS_LOWDELAY&lt;br /&gt;
* IPTOS_THROUGHPUT&lt;br /&gt;
* SO_SNDBUF *&lt;br /&gt;
* SO_RCVBUF *&lt;br /&gt;
* SO_SNDLOWAT *&lt;br /&gt;
* SO_RCVLOWAT *&lt;br /&gt;
&lt;br /&gt;
''Those marked with a '*' take an integer argument. The others can optionally take a 1 or 0 argument to enable or disable the option, by default they will be enabled if you don't specify 1 or 0.''&lt;br /&gt;
&lt;br /&gt;
To specify an argument use the syntax SOME_OPTION = VALUE for example SO_SNDBUF = 8192. Note that you must not have any spaces before or after the = sign.&lt;br /&gt;
&lt;br /&gt;
If you are on a local network then a sensible option might be:&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=socket options = IPTOS_LOWDELAY}}&lt;br /&gt;
&lt;br /&gt;
If you have a local network then you could try:&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=socket options = IPTOS_LOWDELAY TCP_NODELAY}}&lt;br /&gt;
&lt;br /&gt;
If you are on a wide area network then perhaps try setting IPTOS_THROUGHPUT.&lt;br /&gt;
&lt;br /&gt;
Note that several of the options may cause your Samba server to fail completely. '''Use these options with caution!'''&lt;br /&gt;
&lt;br /&gt;
===aio read size===&lt;br /&gt;
Samba will read from file asynchronously when size of request is bigger than this value. Note that it happens only for non-chained and non-chaining reads and when not using write cache.&lt;br /&gt;
&lt;br /&gt;
===aio write size===&lt;br /&gt;
Samba will write to file asynchronously when size of request is bigger than this value. Note that it happens only for non-chained and non-chaining reads and when not using write cache.&lt;br /&gt;
&lt;br /&gt;
===aio write behind===&lt;br /&gt;
Samba will not wait until write requests are finished before returning the result to the client for files listed in this parameter. Instead, Samba will immediately return that the write request has been finished successfully, no matter if the operation will succeed or not. This might speed up clients without aio support, but is really dangerous, because data could be lost and files could be damaged.&lt;br /&gt;
&lt;br /&gt;
==Things to Note==&lt;br /&gt;
'''It can not be under stressed. Bad options can be very BAD. It can corrupt your data and make you very sad. Use extreme caution if elaborating with the options!'''&lt;br /&gt;
&lt;br /&gt;
If you add a new share in Amahi or change the settings of an existing one, Amahi will overwrite the '''/etc/samba/smb.conf''' file with the new configuration and thus removing your changes. A place to enable '''AIO''' in the settings section of Amahi has been suggested at http://bugs.amahi.org/issues/show/861&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Make_Samba_Go_Faster&amp;diff=44623</id>
		<title>Make Samba Go Faster</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Make_Samba_Go_Faster&amp;diff=44623"/>
		<updated>2011-08-11T11:23:03Z</updated>

		<summary type="html">&lt;p&gt;Inquam: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{MessageBox|&lt;br /&gt;
backgroundcolor	= red|&lt;br /&gt;
image	=Warning.png|&lt;br /&gt;
heading	=WARNING|&lt;br /&gt;
message = This is recommended only for advanced users, proceed with caution.}}&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
Amahi makes heavy use of Samba. Samba is what handles shared folders and allow you to connect to your Amahi and browse your folders from Windows etc.&lt;br /&gt;
Greyhole also uses Samba and it's logs to handle file operations.&lt;br /&gt;
&lt;br /&gt;
After installing a wired gigabit network in my house, due to the WIFI being bogged down by 14 wireless clients, I tested the performance in the network. I got around 5-600MBit/sec in read speeds and about 6-700MBit/sec in write speeds. But when I tried against the Amahi server I found that I only got 56MBit/sec in read speeds.&lt;br /&gt;
&lt;br /&gt;
After looking at the samba configuration file I saw that Async IO ('''AIO''') was not enabled by Amahi. What AIO does is that it let's Samba create multiple threads to handle file operations. This can, at the expense of some CPU cycles, increase the performance quite a lot.&lt;br /&gt;
&lt;br /&gt;
I increased the read speed to 500-600MBit/sec by enabling AIO and saw Samba using around 1-4% CPU on a Intel E2200.&lt;br /&gt;
&lt;br /&gt;
==Enable AIO==&lt;br /&gt;
&lt;br /&gt;
To enable AIO an you can add the following to the '''global''' section of your '''/etc/samba/smb.conf''' file&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=&lt;br /&gt;
socket options=SO_RCVBUF=131072 SO_SNDBUF=131072 TCP_NODELAY&lt;br /&gt;
min receivefile size = 16384&lt;br /&gt;
use sendfile = true&lt;br /&gt;
aio read size = 16384&lt;br /&gt;
aio write size = 16384&lt;br /&gt;
aio write behind = true &amp;lt;--- NOTE!!!: Only use with extreme caution. Read explanation bellow&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is only an example but you can tweak all the options to fit your environment and needs. Bellow are an explination of the options used above. More information can be found at http://www.samba.org&lt;br /&gt;
&lt;br /&gt;
==Options Explained==&lt;br /&gt;
&lt;br /&gt;
===min receivefile size===&lt;br /&gt;
This option changes the behavior of Samba when processing SMBwriteX calls. Any incoming SMBwriteX call on a non-signed SMB/CIFS connection greater than this value will not be processed in the normal way but will be passed to any underlying kernel recvfile or splice system call (if there is no such call Samba will emulate in user space). This allows zero-copy writes directly from network socket buffers into the filesystem buffer cache, if available. It may improve performance but user testing is recommended. If set to zero Samba processes SMBwriteX calls in the normal way. To enable POSIX large write support (SMB/CIFS writes up to 16Mb) this option must be nonzero. The maximum value is 128k. Values greater than 128k will be silently set to 128k.&lt;br /&gt;
&lt;br /&gt;
    Note this option will have NO EFFECT if set on a SMB signed connection.&lt;br /&gt;
&lt;br /&gt;
    The default is zero, which disables this option&lt;br /&gt;
&lt;br /&gt;
===use sendfile===&lt;br /&gt;
If this parameter is yes, and the sendfile() system call is supported by the underlying operating system, then some SMB read calls (mainly ReadAndX and ReadRaw) will use the more efficient sendfile system call for files that are exclusively oplocked. This may make more efficient use of the system CPU's and cause Samba to be faster. Samba automatically turns this off for clients that use protocol levels lower than NT LM 0.12 and when it detects a client is Windows 9x (using sendfile from Linux will cause these clients to fail). &lt;br /&gt;
&lt;br /&gt;
===socket options===&lt;br /&gt;
This option allows you to set socket options to be used when talking with the client.&lt;br /&gt;
&lt;br /&gt;
Socket options are controls on the networking layer of the operating systems which allow the connection to be tuned.&lt;br /&gt;
&lt;br /&gt;
This option will typically be used to tune your Samba server for optimal performance for your local network. There is no way that Samba can know what the optimal parameters are for your net, so you must experiment and choose them yourself. We strongly suggest you read the appropriate documentation for your operating system first (perhaps man setsockopt will help).&lt;br /&gt;
&lt;br /&gt;
You may find that on some systems Samba will say &amp;quot;Unknown socket option&amp;quot; when you supply an option. This means you either incorrectly typed it or you need to add an include file to includes.h for your OS. If the latter is the case please send the patch to samba-technical@samba.org.&lt;br /&gt;
&lt;br /&gt;
Any of the supported socket options may be combined in any way you like, as long as your OS allows it.&lt;br /&gt;
&lt;br /&gt;
This is the list of socket options currently settable using this option:&lt;br /&gt;
&lt;br /&gt;
* SO_KEEPALIVE&lt;br /&gt;
* SO_REUSEADDR&lt;br /&gt;
* SO_BROADCAST&lt;br /&gt;
* TCP_NODELAY&lt;br /&gt;
* IPTOS_LOWDELAY&lt;br /&gt;
* IPTOS_THROUGHPUT&lt;br /&gt;
* SO_SNDBUF *&lt;br /&gt;
* SO_RCVBUF *&lt;br /&gt;
* SO_SNDLOWAT *&lt;br /&gt;
* SO_RCVLOWAT *&lt;br /&gt;
&lt;br /&gt;
''Those marked with a '*' take an integer argument. The others can optionally take a 1 or 0 argument to enable or disable the option, by default they will be enabled if you don't specify 1 or 0.''&lt;br /&gt;
&lt;br /&gt;
To specify an argument use the syntax SOME_OPTION = VALUE for example SO_SNDBUF = 8192. Note that you must not have any spaces before or after the = sign.&lt;br /&gt;
&lt;br /&gt;
If you are on a local network then a sensible option might be:&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=socket options = IPTOS_LOWDELAY}}&lt;br /&gt;
&lt;br /&gt;
If you have a local network then you could try:&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=socket options = IPTOS_LOWDELAY TCP_NODELAY}}&lt;br /&gt;
&lt;br /&gt;
If you are on a wide area network then perhaps try setting IPTOS_THROUGHPUT.&lt;br /&gt;
&lt;br /&gt;
Note that several of the options may cause your Samba server to fail completely. '''Use these options with caution!'''&lt;br /&gt;
&lt;br /&gt;
===aio read size===&lt;br /&gt;
Samba will read from file asynchronously when size of request is bigger than this value. Note that it happens only for non-chained and non-chaining reads and when not using write cache.&lt;br /&gt;
&lt;br /&gt;
===aio write size===&lt;br /&gt;
Samba will write to file asynchronously when size of request is bigger than this value. Note that it happens only for non-chained and non-chaining reads and when not using write cache.&lt;br /&gt;
&lt;br /&gt;
===aio write behind===&lt;br /&gt;
Samba will not wait until write requests are finished before returning the result to the client for files listed in this parameter. Instead, Samba will immediately return that the write request has been finished successfully, no matter if the operation will succeed or not. This might speed up clients without aio support, but is really dangerous, because data could be lost and files could be damaged.&lt;br /&gt;
&lt;br /&gt;
==Things to Note==&lt;br /&gt;
'''It can not be under stressed. Bad options can be very BAD. It can corrupt your data and make you very sad. Use extreme caution if elaborating with the options!'''&lt;br /&gt;
&lt;br /&gt;
If you add a new share in Amahi or change the settings of an existing one, Amahi will overwrite the '''/etc/samba/smb.conf''' file with the new configuration and thus removing your changes. A place to enable '''AIO''' in the settings section of Amahi has been suggested at http://bugs.amahi.org/issues/show/861&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Make_Samba_Go_Faster&amp;diff=44617</id>
		<title>Make Samba Go Faster</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Make_Samba_Go_Faster&amp;diff=44617"/>
		<updated>2011-08-11T11:16:57Z</updated>

		<summary type="html">&lt;p&gt;Inquam: Created page with &amp;quot;{{MessageBox| backgroundcolor	= red| image	=Warning.png| heading	=WARNING| message = This is recommended only for advanced users, proceed with caution.}}  ==Background==  Amahi m...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{MessageBox|&lt;br /&gt;
backgroundcolor	= red|&lt;br /&gt;
image	=Warning.png|&lt;br /&gt;
heading	=WARNING|&lt;br /&gt;
message = This is recommended only for advanced users, proceed with caution.}}&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
Amahi makes heavy use of Samba. Samba is what handles shared folders and allow you to connect to your Amahi and browse your folders from Windows etc.&lt;br /&gt;
Greyhole also uses Samba and it's logs to handle file operations.&lt;br /&gt;
&lt;br /&gt;
After installing a wired gigabit network in my house, due to the WIFI being bogged down by 14 wireless clients, I tested the performance in the network. I got around 5-600MBit/sec in read speeds and about 6-700MBit/sec in write speeds. But when I tried against the Amahi server I found that I only got 56MBit/sec in read speeds.&lt;br /&gt;
&lt;br /&gt;
After looking at the samba configuration file I saw that Async IO ('''AIO''') was not enabled by Amahi. What AIO does is that it let's Samba create multiple threads to handle file operations. This can, at the expense of some CPU cycles, increase the performance quite a lot.&lt;br /&gt;
&lt;br /&gt;
==Enable AIO==&lt;br /&gt;
&lt;br /&gt;
To enable AIO an you can add the following to the '''global''' section of your '''/etc/samba/smb.conf''' file&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=&lt;br /&gt;
socket options=SO_RCVBUF=131072 SO_SNDBUF=131072 TCP_NODELAY&lt;br /&gt;
min receivefile size = 16384&lt;br /&gt;
use sendfile = true&lt;br /&gt;
aio read size = 16384&lt;br /&gt;
aio write size = 16384&lt;br /&gt;
aio write behind = true &amp;lt;--- NOTE!!!: Only use with extreme caution. Read explanation bellow&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This is only an example but you can tweak all the options to fit your environment and needs. Bellow are an explination of the options used above. More information can be found at http://www.samba.org&lt;br /&gt;
&lt;br /&gt;
==Options Explained==&lt;br /&gt;
&lt;br /&gt;
===min receivefile size===&lt;br /&gt;
This option changes the behavior of Samba when processing SMBwriteX calls. Any incoming SMBwriteX call on a non-signed SMB/CIFS connection greater than this value will not be processed in the normal way but will be passed to any underlying kernel recvfile or splice system call (if there is no such call Samba will emulate in user space). This allows zero-copy writes directly from network socket buffers into the filesystem buffer cache, if available. It may improve performance but user testing is recommended. If set to zero Samba processes SMBwriteX calls in the normal way. To enable POSIX large write support (SMB/CIFS writes up to 16Mb) this option must be nonzero. The maximum value is 128k. Values greater than 128k will be silently set to 128k.&lt;br /&gt;
&lt;br /&gt;
    Note this option will have NO EFFECT if set on a SMB signed connection.&lt;br /&gt;
&lt;br /&gt;
    The default is zero, which disables this option&lt;br /&gt;
&lt;br /&gt;
===use sendfile===&lt;br /&gt;
If this parameter is yes, and the sendfile() system call is supported by the underlying operating system, then some SMB read calls (mainly ReadAndX and ReadRaw) will use the more efficient sendfile system call for files that are exclusively oplocked. This may make more efficient use of the system CPU's and cause Samba to be faster. Samba automatically turns this off for clients that use protocol levels lower than NT LM 0.12 and when it detects a client is Windows 9x (using sendfile from Linux will cause these clients to fail). &lt;br /&gt;
&lt;br /&gt;
===socket options===&lt;br /&gt;
This option allows you to set socket options to be used when talking with the client.&lt;br /&gt;
&lt;br /&gt;
Socket options are controls on the networking layer of the operating systems which allow the connection to be tuned.&lt;br /&gt;
&lt;br /&gt;
This option will typically be used to tune your Samba server for optimal performance for your local network. There is no way that Samba can know what the optimal parameters are for your net, so you must experiment and choose them yourself. We strongly suggest you read the appropriate documentation for your operating system first (perhaps man setsockopt will help).&lt;br /&gt;
&lt;br /&gt;
You may find that on some systems Samba will say &amp;quot;Unknown socket option&amp;quot; when you supply an option. This means you either incorrectly typed it or you need to add an include file to includes.h for your OS. If the latter is the case please send the patch to samba-technical@samba.org.&lt;br /&gt;
&lt;br /&gt;
Any of the supported socket options may be combined in any way you like, as long as your OS allows it.&lt;br /&gt;
&lt;br /&gt;
This is the list of socket options currently settable using this option:&lt;br /&gt;
&lt;br /&gt;
* SO_KEEPALIVE&lt;br /&gt;
* SO_REUSEADDR&lt;br /&gt;
* SO_BROADCAST&lt;br /&gt;
* TCP_NODELAY&lt;br /&gt;
* IPTOS_LOWDELAY&lt;br /&gt;
* IPTOS_THROUGHPUT&lt;br /&gt;
* SO_SNDBUF *&lt;br /&gt;
* SO_RCVBUF *&lt;br /&gt;
* SO_SNDLOWAT *&lt;br /&gt;
* SO_RCVLOWAT *&lt;br /&gt;
&lt;br /&gt;
''Those marked with a '*' take an integer argument. The others can optionally take a 1 or 0 argument to enable or disable the option, by default they will be enabled if you don't specify 1 or 0.''&lt;br /&gt;
&lt;br /&gt;
To specify an argument use the syntax SOME_OPTION = VALUE for example SO_SNDBUF = 8192. Note that you must not have any spaces before or after the = sign.&lt;br /&gt;
&lt;br /&gt;
If you are on a local network then a sensible option might be:&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=socket options = IPTOS_LOWDELAY}}&lt;br /&gt;
&lt;br /&gt;
If you have a local network then you could try:&lt;br /&gt;
&lt;br /&gt;
{{Text|Text=socket options = IPTOS_LOWDELAY TCP_NODELAY}}&lt;br /&gt;
&lt;br /&gt;
If you are on a wide area network then perhaps try setting IPTOS_THROUGHPUT.&lt;br /&gt;
&lt;br /&gt;
Note that several of the options may cause your Samba server to fail completely. '''Use these options with caution!'''&lt;br /&gt;
&lt;br /&gt;
===aio read size===&lt;br /&gt;
Samba will read from file asynchronously when size of request is bigger than this value. Note that it happens only for non-chained and non-chaining reads and when not using write cache.&lt;br /&gt;
&lt;br /&gt;
===aio write size===&lt;br /&gt;
Samba will write to file asynchronously when size of request is bigger than this value. Note that it happens only for non-chained and non-chaining reads and when not using write cache.&lt;br /&gt;
&lt;br /&gt;
===aio write behind===&lt;br /&gt;
Samba will not wait until write requests are finished before returning the result to the client for files listed in this parameter. Instead, Samba will immediately return that the write request has been finished successfully, no matter if the operation will succeed or not. This might speed up clients without aio support, but is really dangerous, because data could be lost and files could be damaged.&lt;br /&gt;
&lt;br /&gt;
==Things to Note==&lt;br /&gt;
'''It can not be under stressed. Bad options can be very BAD. It can corrupt your data and make you very sad. Use extreme caution if elaborating with the options!'''&lt;br /&gt;
&lt;br /&gt;
If you add a new share in Amahi or change the settings of an existing one, Amahi will overwrite the '''/etc/samba/smb.conf''' file with the new configuration and thus removing your changes. A place to enable '''AIO''' in the settings section of Amahi has been suggested at&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=36067</id>
		<title>Mount Shares Locally</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=36067"/>
		<updated>2011-03-07T06:32:10Z</updated>

		<summary type="html">&lt;p&gt;Inquam: fixed spelling error&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mounting your Samba shares locally is useful when you are using Greyhole, and want to write or in any way work with those files locally. Greyhole data should only be accessed through shares, so mounting those shares locally is an easy way to work with Greyhole data safely.&lt;br /&gt;
&lt;br /&gt;
* Install the mount_shares_locally initd script:&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 curl -o /etc/init.d/mount_shares_locally http://dl.dropbox.com/u/3022105/Amahi/mount_shares_locally&lt;br /&gt;
 chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 chkconfig --add mount_shares_locally&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Edit /etc/init.d/mount_shares_locally in a text editor, and replace ''your_username'' (on line 12) with your username.&lt;br /&gt;
&lt;br /&gt;
* Create the ''/home/your_username/.smb_credentials'' file. This is a simple text file (use your favorite text editor).&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;&amp;quot;&amp;gt;&lt;br /&gt;
 username=your_username&lt;br /&gt;
 password=your_password&lt;br /&gt;
 domain=HOME&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test your new mounts, you can execute '''service mount_shares_locally start'''&amp;lt;br/&amp;gt;&lt;br /&gt;
You will find the mounted shares in ''/mnt/samba/*''&amp;lt;br/&amp;gt;&lt;br /&gt;
'''service mount_shares_locally stop''' will unmount the local shares.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: if you used /etc/rc.local and /etc/fstab to mount shares locally in the past, you can remove what you added in those files now. The above initd script replaces all this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Unable to mount localy after upgrading to Amahi6 ==&lt;br /&gt;
If you try to run mount using this script after you upgraded to Amahi6 you might get greeted by this type of error.&lt;br /&gt;
&lt;br /&gt;
 [root@localhost ~]# /etc/init.d/mount_shares_locally start&lt;br /&gt;
 Mounting Samba shares locally: /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
 /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
                                                           [  OK  ]&lt;br /&gt;
&lt;br /&gt;
It's easily fixed by installing the missing dependency.&lt;br /&gt;
&lt;br /&gt;
{{Code|yum install cifs-utils}}&lt;br /&gt;
&lt;br /&gt;
Now it should work fine to run&lt;br /&gt;
&lt;br /&gt;
{{Code|/etc/init.d/mount_shares_locally start}}&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=36037</id>
		<title>Mount Shares Locally</title>
		<link rel="alternate" type="text/html" href="https://wiki.amahi.org/index.php?title=Mount_Shares_Locally&amp;diff=36037"/>
		<updated>2011-03-06T09:20:20Z</updated>

		<summary type="html">&lt;p&gt;Inquam: Added information about possible fix when script stops working after Amahi6 upgrade&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mounting your Samba shares locally is useful when you are using Greyhole, and want to write or in any way work with those files locally. Greyhole data should only be accessed through shares, so mounting those shares locally is an easy way to work with Greyhole data safely.&lt;br /&gt;
&lt;br /&gt;
* Install the mount_shares_locally initd script:&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll&amp;quot;&amp;gt;&lt;br /&gt;
 curl -o /etc/init.d/mount_shares_locally http://dl.dropbox.com/u/3022105/Amahi/mount_shares_locally&lt;br /&gt;
 chmod +x /etc/init.d/mount_shares_locally&lt;br /&gt;
 chkconfig --add mount_shares_locally&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Edit /etc/init.d/mount_shares_locally in a text editor, and replace ''your_username'' (on line 12) with your username.&lt;br /&gt;
&lt;br /&gt;
* Create the ''/home/your_username/.smb_credentials'' file. This is a simple text file (use your favorite text editor).&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;&amp;quot;&amp;gt;&lt;br /&gt;
 username=your_username&lt;br /&gt;
 password=your_password&lt;br /&gt;
 domain=HOME&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test your new mounts, you can execute '''service mount_shares_locally start'''&amp;lt;br/&amp;gt;&lt;br /&gt;
You will find the mounted shares in ''/mnt/samba/*''&amp;lt;br/&amp;gt;&lt;br /&gt;
'''service mount_shares_locally stop''' will unmount the local shares.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: if you used /etc/rc.local and /etc/fstab to mount shares locally in the past, you can remove what you added in those files now. The above initd script replaces all this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Unable to mount localy after upgrading to Amahi6 ==&lt;br /&gt;
If you try to run mount using this script after you upgraded to Amahi6 you might get greeted by this type of error.&lt;br /&gt;
&lt;br /&gt;
{{Code|&lt;br /&gt;
[root@localhost ~]# /etc/init.d/mount_shares_locally start&lt;br /&gt;
Mounting Samba shares locally: /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
/etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
/etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
/etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
/etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
/etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
/etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory&lt;br /&gt;
                                                           [  OK  ]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It's easily fixed by installing the missing dependency.&lt;br /&gt;
&lt;br /&gt;
{{Code|&lt;br /&gt;
yum install cifs-utils&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
No it should work fine to run&lt;br /&gt;
&lt;br /&gt;
{{Code|&lt;br /&gt;
/etc/init.d/mount_shares_locally start&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Inquam</name></author>
		
	</entry>
</feed>