Media Sharing Using ownCloud

From Amahi Wiki
Jump to: navigation, search
Msgbox-WOPr.png Work In Progress
This article is currently undergoing major expansion or restructuring. You are welcome to assist by editing it as well. If this article has not been edited in several days, please remove this template.


Media files (Music, Photos, Videos) can be stored and accessed on the Amahi Home Server using one of the sharing scenarios with ownCloud.

  1. Using existing “Amahi Shares” for file storage and ownCloud for file access and storage management.
  2. Using ownCloud for file storage, managing access, and file storage management.


Oc tip.png ownCloud Tip!
Before continuing on please make sure the following ownCloud subject areas are understood. "User and Group Administration" and "ownCloud Sharing"


All scenarios should allow other applications on Amahi to access the media files (i.e. Amahi DLNA). Regardless of which scenario is chosen some knowledge of Linux utilities will be required to do the configuration changes. The amount of configuration work needed is about the same for each scenario.

Please Note:

"Scenario 1" is not a configuration to be used when the Amahi Greyhole application is active in the Amahi Server. We hope to provide "wiki guidance" at some point where the Amahi Greyhole feature is used. The second Media Sharing scenario is a better fit as it has no dependencies on Amahi shares or the Greyhole feature.

Before Making Changes

Please read the following sections before making decisions and changes.

Amahi Home Server File Shares

Amahi Home Server provides a set of “Storage Shares” that are available to all Amahi user accounts. Some of them are provided for the purposes of storing media files (Music, Pictures, Movies) for all Amahi users to access. These shares are usually shared via the Samba (SMB) sharing service on the Amahi Home Server.

Some things you need to know:

  • Music media physical location: /var/hda/files/music (a.k.a. Music)
  • Photograph media physical location: /var/hda/files/pictures (a.k.a. Pictures)
  • Video media physical location: /var/hda/files/movies (a.k.a. Movies)
  • Share(s) directory ownership default (chown): <hda_administrator_account>:users
  • Share(s) directory permissions default (chmod): 775 (rwx:rwx:r-x)
  • Storing media files in the shares is usually done by mounting each share locally on a client workstation via the SMB service on Amahi.

ownCloud External Storage Support

ownCloud provides a highly configurable sharing environment for files that are accessible from a Web Browser User Interface (Web UI), the WebDAV service built in to ownCloud, or an ownCloud Sync client installed on a workstation.

Some things you need to know:

  • ownCloud provides an “External Storage Support” feature that supports access to files “external” to the ownCloud “internal” filesystem.
  • File ownership after upload (using ownCloud provided services): apache:apache
  • File permissions after upload (using ownCloud provided services): 664 (rw-:rw-:r--)
  • Required directory ownership for ownCloud: apache:users
  • Required directory permissions for ownCloud: 770 (rwx:rwx:---)

ownCloud Applications

Two ownCloud applications will be discussed; "External Storage" support, "ReScan Filesystem Icon".

  • The "External Storage support "backend" application is required for connecting filesystems external to ownCloud. Login as the ownCloud admin user and navigate to Settings => Apps.


  ownCloud Tip!
Please make sure the following ownCloud subject area is understood: ownCloud Applications


  • Move down the list of applications available to the External Storage support application, click once on it, then click on the "Enable" button.
 
  • Navigate to Settings => Admin there should be a section called "External Storage". There are a number of connection methods available in this setting. Only the "Local" method will be discussed further on.
 
  • The ReScan Filesystem Icon is optional but it is a very good idea to install it.
  • Move down the list of applications available to the ReScan Filesystem Icon application, click once on it, then click on the "Enable" button.
 
  • Navigate to "Files" and the ReScan Filesystem Icon will appear next to the Files menu item.
 
  • Clicking on the icon manually initiates an ownCloud "file scan" of the current ownCloud directory appearing in the Web UI.

Scenario 1: Amahi Media Shares with ownCloud

The default media directories provided by Amahi Home Server can be used to store media files and managed (i.e. uploads, deletions) by ownCloud. Although there is one caution, all management of the media files should be done via ownCloud. If Samba use continues for the media files there is a high risk the files will no longer be visible to users in ownCloud and other Amahi applications. Only a lot of manual changes to file ownership and permissions after any changes can provide visibility to ownCloud and other Amahi applications.

  • Using the server console or remote connection login using the "root" user.
  • Before going past this step the amount of work to be done in the next steps needs to be considered as it CAN be VERY tedious. Do the current Amahi directories already contain files? If so the next steps involve a lot methodical pounding of the keyboard. Or the other alternative would be to move the files elsewhere, do the configuration work, and then upload the files via ownCloud services in to the reconfigured Amahi directories.
  • Using the "cd" command go to "/var/hda/files/".
  • Change the ownership on the movies, music, and pictures directories.
bash code
​chown -vR apache:apache movies chown -vR apache:apache music chown -vR apache:apache pictures​
  • The previous two steps now give the ownCloud application access to the Amahi media directories.
  • Using the "cd" command go in to each of the media directories and change the permissions for any files that might be already stored. Files ownerships were already previously set in a prior step. These settings ensure that all the files already stored are set to the same ownership and permissions as future files stored by ownCloud. These settings also ensure the existing files are visible to ownCloud.
bash code
​cd /var/hda/files/movies chmod -vR 664 * cd /var/hda/files/music chmod -vR 664 * cd /var/hda/files/pictures chmod -vR 664 *​
  • Using the "cd" command go to "/var/hda/files/". Change the permissions on the movies, music, pictures directories. Also any subdirectories below these directories must also be changed to the same permissions.
bash code
​chmod -vR 775 movies chmod -vR 775 music chmod -vR 775 pictures​
  • The Amahi directories have been reconfigured for ownCloud use. The following steps will now involve configuring ownCloud for the sharing of the Amahi directories.
  • Login to the ownCloud admin user. Navigate to Settings => Apps. Make sure the ownCloud applications previously mentioned are enabled.
  • Navigate to Settings => Users.
  • ownCloud media security groups are now created for read/write access.
 
  • Any ownCloud users are now created. While creating ownCloud users the security groups can be associated.
 
  • Navigate to Settings => Admin.
  • The External Storage sharing connections are now created.
 
Mount point:
Defines a "mount point" where an local external share is "mounted" for a current user. The mount point is displayed
as a directory on the user interface. There must be a one-to-one definition of a mount point to each defined
external share configuration. Mount points cannot contain a "space" character.

Backend:
Defines the type of ownCloud "backend" to be used for the external share. In this example the share to be mounted is
on the local system's disk drive system.

Configuration:
This is the "absolute path" for the external share to be mounted. The end of the path must contain a "/" to complete
the path definition, if it is not there the configuration will not work.

Applicable:
This defines the ownCloud User ID(s) or security group(s) that allow access to the external share to be mounted. 
If left blank the configuration will not work.
  • Logging in to the test user account, the three mount point directories should be there.
 
  • Navigate in to one of the mount points reveals the shared files.
 
  • Navigate in to the ownCloud Music application. This displays all of the shared music files.
 
  • Navigate in to the ownCloud Pictures application. This displays all of the shared picture files.
 
  • A DLNA application of client can be used to access the video files. The VLC video player is used in this example as a DLNA client.
 
  • There all done!

Scenario 2: Media Sharing from ownCloud

This scenario calls for storing all media files in the ownCloud filesystem and allows access by other Amahi applications (i.e. Amahi DLNA) to these files. Only one caution, other applications on the Amahi server will have to be configured to access the ownCloud filesystem directories.

 

There are 3 ownCloud users cited in this example. One user owns (mediadmin) the media directories and files, and is defined as an ownCloud "User Administrator". The user administrator role is allowed to create, remove, and change passwords for users that are members of the "mediaRWGrp" security group. All users (mediadmin, test, test1) will have full read/write access to the media directories.

  • Logging in to the ownCloud "admin" user account.


<more to follow>


Main ownCloud Page