Module 2: Unix

Obtaining a UH UNIX Account

The LIS Web Team tutorials assume that you will be using a UHUNIX account (University of Hawaii) to host your Web page. Information presented on this site, such as using FTP, Telnet, Pico, setting permissions, etc…are UHUNIX specific.

If you plan to host your site elsewhere, don’t worry; HTML is the same wherever you go, only the specifics of interacting with your account vary. Contact your Web hosting service for specifications about IP addresses, passwords, and the like.

If you are a student, staff, or faculty member anywhere in the University of Hawaii system, you are entitled to a free UHUNIX account. A UHUNIX account includes one email account (username@hawaii.edu), 20 megabytes of server space, and a place to publish your personal Web page. To request a UHUNIX account, go to the following Web site:

http://www.hawaii.edu/help/accounts/idreqinfo.html


What if I forgot my password?

If you already have a UHUNIX account but have forgotten your password and/or username, call the ITS Help Desk at the number listed below.

UHUNIX accounts are administered by the University’s Information and Technology Service (ITS) office. Problems and questions about your UHUNIX account should be directed to:

ITS Help Desk
Keller Hall Room 105
2565 McCarthy Mall
Honolulu, HI 96822
fax: (808)956-2108
phone: (808)956-8883
email: help@hawaii.edu

Preparing Your Account

Log on to UNIX using a telnet program. SSH for a PC, Fugu for a Mac, available from UH ITS folks- thanks!

There are two different ways to access your UHunix account; text-based and graphics-based. Using SSH, you can switch between the two; on the toolbar, text-based is the gray box with the blue dots, and graphics-based is the yellow folder with the blue dots. Fugu is graphics-based; for text-based UNIX on a mac, go to Applications > Utilities > Terminal.

There are many different ways to perform functions in the various programs.

Log in

Using SSH:
Click on “Quick Connect”
Host name: uhunix2.hawaii.edu
Username: your uhunix username
click “connect” and enter your password.

Using Fugu: 
Connect to: uhunix2.hawaii.edu
Username: your uhunix username
click “connect” and enter your password.


Text-based

The prompt that you see may look similar to this (this is known as your home directory):

uhunix5:/home/14/kmorgan% or it may just be the % sign.

If at any point, you get confused about where you are, you can type the command pwd and you can see which directory you are in.

In UNIX (and most systems) all Web files need to be placed within a directory called public_html (case sensitive!). Some accounts come with this directory already available, and sometimes you need to create one.To see what files and directories you already have, you can display the contents of your main directory. To do this, at the prompt, type in the command to list files in long format, which isls -l (short format is just ls, try it out to see the difference).

Example:
uhunix5:/home/14/kmorgan% ls -l

This will bring up a list similar to this one:
-rw------- 1 kmorgan uhmstud 337 Aug 12 17:12 dead.letter
-rw-rw-r-- 1 kmorgan uhmstud 5668 Sep 18 18:19 evals
-rw-rw-r-- 1 kmorgan uhmstud 726370 Sep 25 13:58 g9data.rtf
-rw------- 1 kmorgan uhmstud 6344 Apr 20 10:43 learning
drwx------ 2 kmorgan uhmstud 512 Oct 12 22:31 mail
drwxr-xr-x 5 kmorgan uhmstud 1024 Oct 14 21:05 public_html

You can see here that I already have a directory called public_html. You can distinguish a directory by looking at the far left-hand side of line, if it begins with ad then it is a directory, as in
drwxr-xr-x 5 kmorgan uhmstud 1024 Oct 14 21:05 public_html

- generally means it is a regular file as in
-rw------- 1 kmorgan uhmstud 6344 Apr 20 10:43 learning.html


Graphics-Based

The right (remote) side of your program may be blank; the left (local) side should show files and folders on your own computer. All of your html files must be placed in a public_html folder.

Folders are called “directories” in UNIX.

Creating Directories in UNIX


Text-Based

To create a directory:

Step One.
Type the command mkdir thenameofyournewdirectory.

Example:
%mkdir coursework
This creates a directory called coursework.

Step Two.
To confirm that you have created the directory, use the command ls -l, or just ls to see the contents.

To create more directories, follow Steps One and Two again.

You must have a public_html directory. This is where your webpage html files will be placed.


Graphics-Based

To create a directory:

SSH
Right click in the “remote” side of the program and select “New Folder.”
OR Click on the shiny folder on the “remote” side.
OR Choose Operation > New folder from the menu.

Fugu
Choose “New Folder” from the top toolbar.
OR Choose SFTP > Make New Directory

You must have a public_html directory. This is where your webpage html files will be placed.

Changing Directories in UNIX


Text-Based

To switch from a directory into one located within it: at the prompt, type the
command cd directoryname.

Example:
%cd public_html

Check the contents by using the ls -l, or the ls command.

To switch back to the directory directly above the one that you are in, just type cd .. (that’s two dots). To return to your home directory type cd.


Graphics-Based

Click on folders to open them. To go back a directory:

SSH
Click the folder with the black UP arrow (in the toolbar)

Fugu
Click the circle with the blue UP arrow (top right)

Setting Permissions in UNIX

In order for your directories and files to be viewed on the Web, you need to give people permission to see your files. There are three types of permissions:

r - read
w - write
e - execute

And three settings (or people) to establish permissions for:

u - user (you)
g - group (everyone else using the UHUNIX server)
o - other, usually called world (everyone else on the Internet)

a – all (user, group, other)


Text-Based

When you view your files, you can see the permission settings. For example:
drwxr-xr-x 5 kmorgan uhmstud 1024 Oct 14 21:05 public_html
so ­ can really be viewed in four parts:

file type  user   group   other 

d          rwx    r-x     r-x

You can change permissions by using the chmod command.
+ adds a permission
- takes away a permission

When you change permissions, you first give the chmod command, followed by the settings that you are going to change, then the function you want to perform (add or take away), the permissions you want to apply and then the name of the file or directory that you want to change.

Your public_html and all the directories in it must be world executable in order to be viewed on the Web. To change the permission, type:
%chmod o+x public_html

All the files in your public_html directory must be world readable:
chmod a+r filename.

It is a good idea to restrict the write command to the user only. This prevents other people from tampering or altering your files. If you authorize permission, never be surprised what some people will do. Protect your files!


Graphics-Based

SSH

Right-click the folder or file and choose “Permissions”

Fugu

Click on the folder or file and click on “Info” in the above toolbar, or hold down the Open-Apple and i keys on the keyboard.

All files and folders must be readable in order to be read online and by you. Check all the boxes under “read.”

Your public_html and all the directories/folders) in it must be other executable in order to be viewed on the Web. Check all the boxes under “execute” for every folder/directory.

You need to be able to write to your own files; Check the box under “owner-write”

It is a good idea to restrict the write command to the user only. This prevents other people from tampering or altering your files. If you authorize permission, never be surprised what some people will do. Protect your files!

Common UNIX/PICO Commands

Here is a list of common UNIX commands from the UH Information Technology Services web site. ITS also provides a very good web page that contains frequently asked questions about UH UNIX and individual user accounts.

Command

Description and Examples

ls Displays a list of files and directories in the current directory.
ls -l Displays a detailed list of files and directories in the current directory.
cd
Change directory or go to another directory.
Example: To move to subdirectory public_html.
cd public_html
pwd Displays the full pathname of the current working directory.
rm
Delete a file.
Example: To delete a file named graph.jpg.
rm graph.jpg
cp
Copy or duplicate a file.
Example: To copy the file graph.jpg, where the new file is called interest.jpg.
cp graph.jpg interest.jpg
mv
Move or rename a file.
Example: To rename the file father.jpg to dad.jpg.
mv father.jpg dad.jpg
mkdir
Create a new directory.
Example: To create a new directory called public_html.
mkdir public_html
rmdir
Delete a directory. Note the directory must be empty.
Example: To delete a directory named project3.
rmdir project3
more
Displays the contents of a text file one screen at a time.
Example: To display the contents of a file called index.html.
more index.html

UNIX commands, descriptions, and examples from UH ITS web site, Accessed [10.07.01]

Advertisements