March 12, 2008

AjaXplorer simplifies browser-based server filesystem interaction

Author: Ben Martin

AjaXplorer presents a browser-based file explorer interface to your Web server using AJAX. It comes in handy when you want to allow non-technical people to also access your file server, possibly over the Internet. Most non-techies are familiar with the file explorer interface, so having one inside a browser window is easy to get used to.

AjaXplorer is written in PHP. To install it, just expand the distribution ZIP file into your Apache DocumentRoot, which is normally /var/www/html. The distribution archive expands into a AjaXplorer-2.3-SNAPSHOT subdirectory. You will want to change the permissions for the directory and perhaps rename it to something simpler, such as ajaxplorer. Installation is shown below:

cd /var/www/html
unzip ajaXplorer-2.3.1.zip
mv AjaXplorer-2.3-SNAPSHOT ajaxplorer
chmod -R apache.apache ajaxplorer
chmod -R o-rwx ajaxplorer
cd ajaxplorer
chmod g+w users
chmod g+w files

The administrator password for AjaXplorer is set near the top of conf/conf.php using a define( ADMIN_PASSWORD, ... ) statement. After you have updated that password, AjaXplorer is ready to use.

AjaXplorer stores files in repositories. To protect the files uploaded to the server from being downloaded directly, I recommend either changing the path to the files directory or using a custom repository (which we'll talk about in a moment). For example, with the default setup shown above, you can go to http://localhost/ajaxplorer/files/foo.png to download the foo.png file without AjaXplorer performing any access control. If you place the main "files" repository out of the Apache DocumentRoot, then you can no longer get around AjaXplorer access control in this manner.

To use AjaXplorer you must be authorized as a user. To create a new user, log in as admin using the password you set above and click settings in the top right of the toolbar. The settings window is quite spartan, allowing you to create and delete users and modify a handful of settings for each user. I didn't find any tie-in to the Linux system users that might allow you, for example, to set up each user's home directory as their default repository. After creating a new user, click on the user name and edit which repositories the user can read and write. If you do not set any repositories, it will appear that authentication has failed when the user attempts to log in.

The files subdirectory in the ajaxplorer directory is the default repository, but you can set up additional ones. The below code will set up a new repository in /usr/local.

# cd /usr/local
# mkdir ajaxplorer-repository
# chown apache.apache ajaxplorer-repository
# chmod o-rwx ajaxplorer-repository
# chmod g+w ajaxplorer-repository
# chmod +s ajaxplorer-repository
# date > /usr/local/ajaxplorer-repository/datefile.txt
# vi /www/ajaxplorer/conf/conf.php
...
$REPOSITORIES[1] = array("PATH"=>"/usr/local/ajaxplorer-repository", "DISPLAY"=>"File Server");
...

AjaXplorer does not let you move files between repositories from the Web interface. Also, when you allow a user access to more than one repository, the user cannot select which repository to use from the Web interface. The only way I could select which repository a user could access was by explicitly setting the repository that the user was permitted to access from AjaXplorer's user maintenance window.

128854-1-thumb.png

In the Web interface you can choose between a columned display mode showing the filename, size, type, and last modified time, or an icon view that shows a thumbnail and filename for each file. You can adjust thumbnail size with a slider widget at the top of the icon view. You can also view image files singularly with options to zoom in to 200%, download the image, or move to the previous and next file in the directory.

The AjaXplorer INSTALL.txt file claims that you need FTP access to upload files to your server. I suspect that this was an old requirement, as I could upload files from Firefox without any FTP daemon running on the server.

AjaXplorer's edit online option for files lacked error handling; if the file itself could not be written by AjaXplorer, I was not informed of any failure and would assume falsely that saving the changed file worked. If your filesystem permissions allow the editing operations then you shouldn't run into this issue, but knowing if an edit has failed would be handy. Renaming or moving files did report success and failure with a green or red pop-up message after the operation is attempted.

AjaXplorer is a useful tool for folks who maintain a home server and would like to let relatives store and manage files on it without teaching them how to use the shell, FTP, or SSH. A bonus of using AjaXplorer instead of something like Samba or NFS is that you can upload, download, and manage files using a simple interface no matter where you are.

Categories:

  • Tools & Utilities
  • Internet & WWW
Click Here!