Changes

From Amahi Wiki
Jump to: navigation, search
491 bytes added ,  00:41, 10 December 2020
heading =WARNING|
message = This is recommended only for advanced users, proceed with caution.}}
This tutorial is now available as the Amahi [https://www.amahi.org/apps/greyhole-mount-shares-locally Greyhole Mount Shares Locally] application.
 
==Purpose==
Mounting your Samba shares locally within your HDA is useful when you want a process '''running within your HDA''' to write data in a way that ends up in a Greyhole-managed share.
The reason is that Greyhole data should '''only be accessed modified through shares'', not directly onto the local file system, so mounting those shares locally is an easy way to work with Greyhole data safely.
For example, if an app like a downloader gets files from the internet and you want those files to be in a Greyhole-managed share, it has to place them into the share, not directly into the operating system, or Greyhole otherwise cannot handle them.
== Download and Setup ==
* As '''root'''(or precede commands with <code>sudo</code>), install the mount_shares_locally initd script:
=== On Amahi 10 or greater (Fedora) ===
dnf install cifs-utils
cp /usr/share/hda-ctl/mount_shares_locally /etc/init.d
chkconfig --add mount_shares_locally
=== On Amahi 7/8/9 (Fedora) ===
yum install cifs-utils
curl -o /etc/init.d/mount_shares_locally <nowiki>http://dl.amahi.org</nowiki>/mount_shares_locally.fedora
::'''NOTE:''' <code>yum</code> (deprecated) has been replaced with <code>dnf</code> as the package manager for Fedora 23 or greater.
=== On Amahi 6 (Ubuntu 12.04) ===
sudo apt-get install cifs-utils curl
sudo curl -o /etc/init.d/mount_shares_locally <nowiki>http://dl.amahi.org/mount_shares_locally.ubuntu</nowiki>
== Configuration ==
* As '''root''', edit ''/etc/init.d/mount_shares_locally''**Replace ''"***set this string to your username!***"'' (line 12) with your username. For example ''': username="amahi"''';**The script may require the MariaDB root password be changed: ***Please see [[Database Root Password]] for the appropriate login password(change for Amahi 10 '''ONLY''').***Also if you changed the MariaDB root password on your own. :<blockquote>Change ''hda'' (line 25) to the appropriate passwordif needed:<prestyle="white-space: pre-wrap; word-break: keep-all;">mysql -u root -phda p hda -e "select name from shares" hda_production | grep -v "^name$" | xargs -d "\n" mkdir -p</pre></blockquote>
* Create the ''/home/your_username/.smb_credentials'' file. This is a simple text file (use your favorite text editor).
vi /home/your_username/.smb_credentials
ls -al /home/your_username/.smb_credentials
:'''NOTE:''' your_username and your_password in the .smb_credentials file needs to be the original username (1st Admin User) and password you created when you installed the OS ('''NOT''' ''root''). Also ensure the domain matches the ''Workgroup'' set for shares.
*To test your new mounts, you can execute as root user:
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
<pre style="white-space: pre-wrap; word-break: keep-all;">testparm -s /etc/samba/smb.conf 2>/dev/null | grep "^\[" | grep -v "\[global\]" | grep -v "\[homes\]" | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d "\n" mkdir -p</pre>
with
<pre style="white-space: pre-wrap; word-break: keep-all;">mysql -u root -p -e "select comment from shares" hda_production | grep -v "^comment$" | xargs -d "\n" mkdir -p</pre>
12,424

edits