28
|
Using the Symbolic Method
Using
the Symbolic Method, you can set permissions exactly like you do using the Binary method.
The only difference is you use a verbose way of setting the permissions instead of a mathematical
way. To do set the same permissions as in the Binary Method example, we would use the commands:
‘chmod u=rwx,g=rx,o=r test.sh’. You can work out how to build the command up each time using
a very simple table. Note that in the example above we have used commas (,) to separate each
permissions for each party.
Some other examples of chmod using the Symbolic method are as follows:
Lets try this using the same example as in the binary method.
cd ~/unixintro
pwd
ls -la
cat phonebook
chmod u=,g=r,o=r phonebook
cat phonebook
Changes Directory to ‘unixintro’,
located inside your home directory
Print the current working directory
and check it’s correct.
List the contents of the working
directory
Make a note of the original
permissions for ‘phonebook’ - you
will need to restore them!
Read the contents of the file
‘phonebook’
Change permissions of ‘phonebook’
Now try to read the file ‘phonebook’.
What happened?
Now restore the original permissions
and try again