Information for Creating/Editing an Individual Website for the UNIX Web Server


Auburn University students and employees may request individual web space, which can be accessed by a web browser at auburn.edu/~username. Use the following information for creating and editing your Individual Website.

Using this request form, OIT will provision 2GB of publicly available web space to eligible users, which can be displayed by a browser at auburn.edu/~username (this will resolve to webhome.auburn.edu/~username).

*Until you add a file (named index.html, index.htm, or index.php [necessary if you plan to use PHP code]) with HTML code as part of the file, you will receive a "Forbidden" error message. See instructions below regarding how to upload the file.

Note: This resource is to be used in support of the University's mission and subject to University policy, specifically the Appropriate Use of Information Technology Policy.

Several classes require students to modify their web content in this directory.

 

STEP ONE - Determine how you will access this web space/files.

Options include:

Note: If you are not on the Auburn University network, you must first connect to the VPN client to gain access to your personal directory. Follow these steps on how to connect to the Global Protect VPN.

 

STEP TWO - Create/update web files

Using the development tool of your choice (e.g., Adobe Dreamweaver, Notepad, etc.) create new files and folders directly (or SFTP'd into) in your public_html.

The default page to be loaded by the web server should be named index.html (or index.php if you're using PHP).

Example using Notepad

  1. Create a folder on your local computer for your website, perhaps in My Documents\My Websites.
  2. Open Notepad and save a file called index.htm or index.php. This will be the first page that loads on your site.
  3. Create additional files with .htm or .php file extensions for additional web pages. Put images in folders to help keep your directory clean.
  4. Type the required HTML and/or PHP code into the files and save them.
  5. Use WinSCP, CyberDuck or Filezilla to transfer the file to the server.

 

STEP THREE - Verify the changes

Open a web browser and check your changes and additions.

Common Errors:

  • 404 - File Not Found: this means the browser cannot file the file. Did you upload it correctly? Are you trying to load the correct file name? Does the folder have a index.html, index.htm, or index.php file?
  • 403 - Forbidden: this means you don't have access to view these files. Usually this means the permissions are not set to world-readable (aka by a web browser). This KB article about Understanding UNIX file permissions may help. Permissions can be updated via a program like SecureCRT or FTP programs like WinSCP and FileZilla.

Here are a few of the commands you can use (italic commands require changes):

pwd : determines the present working directory

cd directory: change directories; i.e. cd /home/home9/username/subdir

ls : list of all the files in a directory

ls -l : detailed list of all the files, including file permissions, ownership, and groupname.

ls -R : recursive parameter; see all the subdirectories and files in and below the present one

ls -alR : recursive long listing including any hidden files

cp filename newname : make a copy of a file within the present working directory

cp filename targetdirectory : copy a file to another directory

mv filename newname : "move" or rename a file within the present working directory

mv filename targetdirectory : move a file to another directory

rm filename : delete a file located in the present working directory

mkdir newdirectory : make a new directory; use chmod command afterward and chgrp command if it is a shared directory

rmdir directoryname : delete a directory; will not work if files are in the directory

command1 | command2 : send the output of one program to another by putting a | (the pipe symbol) between two commands; for example, if you want to look at a list of your files, but you have too many files to see at once, you can prevent them from scrolling too quickly by piping the ls command into the more command like this ls | more.

command > filename : send the output of a program to a file; for example, to send the output of the ls command to the filelist.dat, use ls > filelist.dat.

man command : find more information about a particular command

cd /usr/bin : use this to display a complete list of commands that can be found

ls : use this to display all the commands

You can also use the asterisk (*) as a wildcard to set the permissions for all the files in a directory.

Permissions are divided into three types:

r - read the file or directory
w -
write to the file or directory
x -
execute the file or directory

Read permission allows a user to read the contents of the file, or in the case of directories, to list the contents of the directory.

Write permission allows the user to write to and modify the file. For directories, write permission allows the user to create new files or delete files within that directory.

Execute permission allows the user to run the file as a program or shell script (if the file happens to be a program or shell script, that is). For directories, having execute permission allows the user to cd into the directory in question.

Each of these permissions is set for each of three types of users:

u - the owner of the file
g - members of the group to which the owner belongs
o - all other users

By setting the permissions, the file owner controls what users of each type can and cannot do to the file. The permissions to a file are listed as a string of nine characters like this:

user group other
r w x r w x r w x

You can view the permissions of a file by entering ls -l at the command line prompt. The output will be a list of all the files and directories in your present directory. An example of one line from such a list would be:

-rwxrw-r-- smithjo client 3754 Feb 24 15:30 my.txt

The first (-) tells you if the entry is a file(-), directory(d), or a link(l). It is followed by the permissions list for the file, directory, or link. This is followed by the username of the person who owns the file or directory, in this case smithjo. The owner's username is then followed by the name of the owner's group (client), the size of the file(in bytes,3754), the date the file was last modified (Feb 24 15:30), and finally the name of the file (my.txt).

File permissions are set or changed with the chmod command. There is a shorthand way of setting permissions by using octal numbers. Read permission is given the value 4, write permission the value 2 and execute permission 1. These values are added together for any one user category:

1 = execute only
2 = write only
3 = write and execute (1+2)
4 = read only
5 = read and execute (4+1)
6 = read and write (4+2)
7 = read and write and execute (4+2+1)

So access permissions can be expressed as three digits. For example:

  user group others
chmod 664 file1 -rw- rw- r--
chmod 644 file1 -rw- r-- r--
chmod 775 directory1 drwx rwx r-x

Use these UNIX commands to change file and directory permissions:

chmod 644 filename : if the file is yours alone, you must restrict the group permissions to allow read only (because everyone is a member of the group other); allow the "world" to read only

chmod 664 filename : if the file is to be shared, remember to first change the group ownership using chgrp command as above; give read and write access to the group, and allow the "world" to read only, by using the command

chmod 775 directory : allow read, write and execute permission to the owner and group, and allow the "world" to read and execute, by using the command

chmod 666 PHP_data_file : any data file that needs to be written to by a PHP script has to be world-readable and writable (*It is recommended that you NEVER set file permissions on the main Auburn webservers to include "other" write access because anyone at Auburn will be able to write to that file. Instead, work with the Office of Information Technology (OIT) to have the "user" changed to "Apache" which will allow the webserver to still write to the page, but other Auburn users will not have write access. If the data that PHP is writing is sensitive data, you may not even want "other" to have read access to that file. Again, work with OIT to get this set up correctly.)

Where filename is the name of the file or directory is the name of the directory. You can also use the asterisk (*) as a wildcard to set the permissions for all the files in a directory:

UNIX also allows files to be shared. In this way, files can be maintained by the persons responsible for them but altered by no one else. Although each file is owned by a particular user, it is also owned by a particular group, which is a system-defined group of users. Each user always belongs to at least one group. On the OIT Sun Network, there is a general group called other to which everyone belongs. Use these UNIX commands to view and change group access:

groups : determine what groups you are in

ypmatch groupname group : find out who is in a particular group

chgrp groupname filename : after uploading a file, will change file access to only those in your group

chgrp groupname directory : after uploading a directory, will change directory access to only those in your group

The system administrator creates groups for various purposes. For example, the persons maintaining a home page for an organization are all placed into a group for that organization (e.g., sga or upc). There are similar administrative groups, as well as a few system-defined groups used to control access to resources.