next up previous
Next: Wildcards Up: Lab 2: Shell, Environment Previous: A Simple Shell Script

Accessing the Files and Security Issues.

The chmod command we used previously changes the access mode into a file. It is used to change the permission for the owner and other users to read, modify or execute the file. For example, if
ls -l

displays

$-$$rw$$-$$r$$-$$-$$-$$-$$-$ 1 userid cs241 82 Jun 30 17:11 temp
$-$$rw$$-$r$-$$-$$-$$-$$-$ 1 userid cs241 304 Jul 14 10:48 first
$drwxr$$-$x$-$$-$x 2 userid cs241 4096 May 15 17:23 labs

then the information about the files and their permissions is in the first column.

Each line of the first column starts either with '$d$' or '$-$'. '$d$' means that the file is a directory, '$-$' denotes a regular file.

The next three characters describe the permission to the owner of the file. '$r$' means file is readable, '$w$' file can be modified (i.e. it is writable), '$x$', file is executable. Symbol '$-$' instead of '$x$' means that the user has no permission to execute the file, similarly for reading and modifying. The next three characters, starting from fifth position, give the permission to a group including the owner. Membership of userid in the group cs241 is specified in columns three and four of the list. The last three characters of each line in column one describe the permission to all other users.
For example to allow others to read your first script use:

chmod o$+$r first

To remove that permission type:
chmod o$-$r first.


next up previous
Next: Wildcards Up: Lab 2: Shell, Environment Previous: A Simple Shell Script
Instructional Support Group 2008-08-05