cd
cd it244
cd ex
mkdir ex9
cd ex9
cd
pwd
ls -l
cd ~tsoro
pwd
ls -l
cd ~/it244/ex/ex9
pwd
nano to create the file name.txt
nano name.txt
nano.
ls -l name.txt
You have read and write permission on this file
cat name.txt
You have read permission so you can run cat on it.
nano
nano name.txt
You can only open the file if you have read permission.
nano.
cat name.txt
You have write permission so you were able to change the file.
chmod 400 name.txt
ls -l name.txt
You are the only one who has any permissions on this file.
cat name.txt
nano
nano name.txt
nano
Control X
When asked the following, press "N".
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
cat name.txt
Nothing has changed.
chmod 000 name.txt
ls -l name.txt
cat name.txt
You can't because you no longer have read permission.
nano
nano name.txt
You get an empty file because you do not have read permission now on the file
Control X
chmod 644 name.txt
ls -l name.txt
cat name.txt
You can now run cat on the file because you
have restored your read permission on the file.
chmod with Numeric Arguments
cd ~/it244/ex/ex9
pwd
touch test.txt
ls -l test.txt
chmod 600 test.txt
ls -l test.txt
chmod 666 test.txt
ls -l test.txt
chmod 644 test.txt
ls -l test.txt
rm test.txt
cd ~/it244/ex/ex9
pwd
nano ex9.sh
chmod with Numeric Arguments.
bash ex9.sh > /dev/null
Running ex9.sh this way
will only print error messages.
~tsoro/it244_test/ex09.sh
When the script asks if you are ready for more, hit Return or Enter.