Site Maintenance: File and Directory Structure
Unless you're creating and editing your files online, you'll always have two copies of every file: one on the server (remote) and one on your disk (local). To avoid problems, you should keep these files synchronized; every time you edit a page, upload the new page. If you edit a file remotely (that is, using a Unix text editor such as pico), you'll need to download the new file:
- Open an SSH File Transfer session
- On the remote (right) side, double-click the public_html folder to move into the public_html directory
- On the local (left) side, navigate to your removable drive (select My
Computer, then find your removeable disk)
- Select the file you wish to download on the remote side
- You can drag it over to the local side and drop it,
or
- select download from the Operation menu, or
- select download dialog from the Operation menu (this will prompt you for the file), or
- use the down arrow (this will prompt you for the file)
- Check the status window at the bottom of the File Transfer screen. It will indicate if the transfer was successful or not
To maintain the proper relative file locations, you should keep your local files arranged in the same structure as the remote files. That is, you could have a folder called public_html on your disk (or whatever removable media you're using. If the local folder is not named public_html, just remember that everything in that folder goes in the public_html directory on the server.
You can nest folders within the top-level folder: for example, a folder called projects for your English 344 class, a folder called images for all your image files, and so on. But you'll need to use these same names for your directories on the server. Fortunately, you can use SSH to upload entire folders. Follow the directions for uploading files, but rather than selecting a file, select an entire folder. The uploaded folder will create a directory on the remote side, and all of your relative links should work.
If the files in an uploaded folder all return Error 403: Forbidden messages, check the permissions:
- Open SSH File Transfer window (see the instructions on uploading files)
- Right-click on the problematic folder / directory on the remote side.
- Select Properties from the popup menu.
- The permissions for the directory should look
like this (These will be check-marks, not Xs):
Read Write Execute
Owner X X X Group X X Other X X Permission Mode: 755 - To change permissions, just click in the appropriate boxes
You can also create directories using SSH :
- Open SSH File Transfer window (see the instructions on uploading files)
- Click on the new folder (a folder with a starburst) icon (left of the red
"X" [delete] icon), or
- Select New Folder from the Operations menu
- This creates a new directory with [ ] as name
- Type the new name and hit Enter
- The default permissions will be 700, which will not allow anyone to view these files, so
- Right-click on the problematic folder / directory on the remote side.
- Select Properties from the popup menu.
- The permissions for the directory should look like this (These will be
check-marks, not Xs):
Read Write Execute
Owner X X X Group X X Other X X Permission Mode: 755 - To change permissions, just click in the appropriate boxes
You should also backup your entire site to your home computer. Simply copy the contents of your removable disk or drive to your home computer. Now you have three copies to keep in sync. If you edit a file on your home computer, make sure you copy it to your disk. One of the most frustrating problems is overwriting changes you've made by uploading an outdated file to the server. Remember, when you upload a file, you overwrite the copy on the server.
A good practice is to keep a copy of your entire site on your home computer, and a complete working copy on a removable disk. You can edit and upload files from the disk anytime, but be sure to copy them back to your home machine. You can do this by copying from the removable disk, or by downloading the entire site to your home computer after you've uploaded the edited files.
Remember: always have a backup
Dean Taciuch
GMU English Department
This work is licensed under a Creative
Commons License.