Problem:
I often need to have some files readily available online so that I can access them from any computer. There are many ways to go about solving this problem and each comes with its set of shortcomings:
The solution I am about to suggest is intended for --
I am a linux user and I have user level access to a web server. The web server is configured such that the public does not have access to directory structure. So, I would need to write a script that copies my files to the web server and creates an index listing my files. Password protection of the storage would follow after that.
Client Side:
Use the following script to transfer file to server, make the file readable by public and execute indexing script on the server.
Server Side:
Put the script below in the storage and it will be executed every time a file is transferred to the storage directory. It creates a new index file every time you transfer file. The script is necessary because most web servers don't allow outsiders to see their directory/file structure. So, this script is needed to create an index of files.
P.S. The source code formatting courtesy of http://formatmysourcecode.blogspot.com/
I often need to have some files readily available online so that I can access them from any computer. There are many ways to go about solving this problem and each comes with its set of shortcomings:
- Yahoo! Briefcase - 30MB limit
- Online storage services like Box.net, Xdrive, MediaMax - usually cost money; signing up is cumbersome
- Email to myself as an attachment - enough said there
The solution I am about to suggest is intended for --
- A *NIX user
- someone with access to a *NIX web server
I am a linux user and I have user level access to a web server. The web server is configured such that the public does not have access to directory structure. So, I would need to write a script that copies my files to the web server and creates an index listing my files. Password protection of the storage would follow after that.
Client Side:
Use the following script to transfer file to server, make the file readable by public and execute indexing script on the server.
#!/bin/tcsh
scp -r $1 user@server:path_to_storage_directory
ssh user@server 'chmod 644 path_to_storage_directory/$1; source path_to_storage_directory/script'
Server Side:
Put the script below in the storage and it will be executed every time a file is transferred to the storage directory. It creates a new index file every time you transfer file. The script is necessary because most web servers don't allow outsiders to see their directory/file structure. So, this script is needed to create an index of files.
Next will come the password protection of the online storage.#!/bin/tcsh
cdpath_to_storage_directory
;
echo "<html><pre>" > index.html ;
ls -lth | sort -r -k 6 | awk '{print $3"\t"$5"\t"$6"\t"$7"\t\t" "<a href=\""$8"\">"$8"</a>"}' >> index.html;
echo "</pre></html>" >> index.html
P.S. The source code formatting courtesy of http://formatmysourcecode.blogspot.com/
Comments