Media Sharing Using ownCloud
Media files (Music, Photos, Videos) can be stored and accessed on the Amahi Home Server using one of the sharing scenarios with ownCloud.
- Using existing “Amahi Shares” for file storage and ownCloud for file access and storage management.
- Using ownCloud for file storage, managing access, and file storage management.
Recommendation? Choose one of the scenarios and stick with it. If both are used it could lead to confusion later, especially when sharing problems need to be debugged.
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.
Contents
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 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.
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.
Please Note:
This scenario was not intended to be used with Amahi Greyhole enabled. Greyhole should be disabled in order to use this scenario.
Please do the following carefully:
- 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.
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.
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.
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 "path" for the external share to be mounted. 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
In this scenario all media files are stored in the ownCloud filesystem, other Amahi applications (i.e. Amahi DLNA) can still access these files. Only one caution, other applications on the Amahi server will have to be configured to access the ownCloud filesystem media directories.
There are three ownCloud users defined in this example. One user owns (mediadmin) the media directories and files, and is defined as an ownCloud "Group Administrator". The group 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. The other users (test, test1) are normal ownCloud users.
- Logging in to the ownCloud "admin" user account.
- Navigate to Settings => Users.
- Create the "mediaRWGrp" security group.
- Create the "mediadmin" user, configure the ID for security group membership, and as the "Group Administrator".
- Logging as the "mediadmin" user and navigating to Settings => Users.
- Create the "test" and "test1" users. This is just a demonstration of the role a group administrator role plays.
- Create the media directories.
- Navigate back to "Files". Setup the "Shared Media" to share with the "mediaRWGrp" security group.
- Any user IDs (mediadmin, test, test1) that are members of the "mediaRWGrp" security group have full read/write access to the "Share Media" directories and files.
- Upload music, pictures, and videos in their respective directories.
- Logging in to "test" or "test1", navigating through "Files", Music app, and Pictures app reveals the share media files.
Videos Folder: Music Application: Pictures Application:
- The directory paths for any applications that need to access the media files stored in ownCloud need to be setup (Amahi DLNA Wiki article).
Media file paths for this example: * /var/hda/files/ownCloud/data/mediadmin/files/Shared Media/Videos * /var/hda/files/ownCloud/data/mediadmin/files/Shared Media/Music * /var/hda/files/ownCloud/data/mediadmin/files/Shared Media/Pictures
- There all done!