Docsity

UNIX File Permissions: Understanding Access and Chmod Commands, Slides of Fundamentals of E-Commerce

Partial preview of the text

Download UNIX File Permissions: Understanding Access and Chmod Commands and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

More about access permissions

When deciding who can have access to a file,UNIX recognizes three categories of users:1. Owner: The owner of the file or directory2. Group: Other users belonging to the owner’s

group

  1. Public: All other users on the system

Types of access

There are three things that can be done to a

file

  1. Read: Examine (but do not change) the file2. Write: Change the file3. Execute: If the file contains a program, run

the program There are also three things that can be done to a directory

  1. Read: List the contents of the directory2. Write: Change the directory by adding or

removing existing files

  1. Execute: “Search” the directory using ls –l

More about chmod

The chmod (change mode) command can usethe following notation:

u^

user (owner) of a file/directory g^

group o^

others (public) +^

add a permission

-^

remove a permission

Examples:

chmod o+r resume.htmlchmod g-x resume.html

Values associated with types

There are also values associated with each typeof access:

r^ ↔

w

x^

The sum of these values gives a combination ofthe permissions.Examples:

4 = r only6 = r and w but not x7 = r, w, and x

Renaming files

The important command:• Rename (move) a file:

mv old_name new_name

Examples:• Change the name of resume.html to main.html• Make the name of the image file all lowercase

Copying files

After submitting Web pages, you should not makechanges to them. Any changes should be made toa copy of the page.The important commands:• Create a new directory:

mkdir directory_name

  • Copy a file:

cp old_name new_name

Example: Copy the main page.

Using * with commands^ The * may be used to match any string of textwhen using a Unix command.Examples:

  • chmod 644 .html• rm .• cp ect250/ ect250bk/• mv old_ect250/* new_ect250/

Condensing commands Several Unix commands can be condensed intoone command.Examples:

  • cd public_html/ect250/• cd ../../• cp ctilogo.gif pictures/ctilogo.gif• mv main.html ../index.html