Complete this assignment by downloading this HTML file and editing it (using a text editor---not a special HTML editor). Wherever you see emphasized text (e.g. "Your name" and "Your Student Number" above) you should insert your own text, as appropriate. Submit via D2L by 5:00 p.m. on Wednesday, February 17.
Using the manpage, man history
, explain the
command expansion of the following history substitutions:
!!
*Change this with your answer
!-4
*Change this with your answer
!ls
*Change this with your answer
!34
*Change this with your answer
Assuming that the .bash_history
file contains the
most recent version of your bash history. Give commands (possibly
including pipelines) which will do the same as the following
history expansions. To put this another way, lets say that the
history expansions were disabled. How could you re-create them?
Note that your commands should simply display the corresponding
history entry, but do not need to execute them.
!!
*Change this with your answer
!-4
*Change this with your answer
!ls
*Change this with your answer
On Ubuntu 14.04, determine if the following are allowed or not allowed. Assume each command is independent. If not allowed, provide a brief explanation why.
rm -rf /etc
Change with your answer
mkdir -p /tmp/foo/bar
Change with your answer
cd /tmp; touch foo; chmod a-rwx foo; rm -fr
foo
Change with your answer
cd /tmp; mkdir goo; touch goo/bar; chmod a-w goo; rm
-fr goo/bar
Change with your answer
echo hi > /bin/ls
Change with your answer
For each exercise part, replace the sequence of
chmod
commands with one chmod
that uses
the octal syntax. You can assume that "file" is created from
scratch for each command.
touch file; chmod a=rwx file; chmod a-r
file
*Change this with your answer
touch file; chmod a=rwx file; chmod go-rwx
file
*Change this with your answer
touch file; chmod a=rwx file; chmod go-rwx file;
chmod g+r file
*Change this with your answer
touch file; chmod 0000 file; chmod u+rw
file;
*Change this with your answer
umask
and
PermissionsUser alice
types the following commands:
alice% umask 0007
alice% cd /tmp
alice% mkdir top-dir
alice% chmod o-rw top-dir
alice% chmod o+x top-dir
alice% chmod ug=rwx top-dir
alice% echo "A message" > top-dir/msg
alice% chmod 0000 top-dir/msg
alice% mkdir top-dir/test
alice% chmod 0707 top-dir/test
alice% echo "Hi There" > top-dir/test/hi
alice% chmod a+rw top-dir/test/hi
Determine if the following commands are allowed (i.e., is there sufficient permission) or not allowed. If they are not allowed, provide a brief explanation.
User bob
tries the following command.
bob
is in the same group as alice
.
(hint: /tmp/top-dir/test
permission is
0707).
ls -l /tmp/top-dir/test
Change this with your answer
User bob
tries the following command.
bob
is in the same group as
alice
.
touch /tmp/top-dir/bob-was-here
Change this with your answer
User sue
tries the following command.
sue
is not in the same group as
alice
.
touch /tmp/top-dir/sue-was-here
Change this with your answer
User sue
tries the following command.
sue
is not in the same group as
alice
.
touch /tmp/top-dir/test/sue-was-also-here
Change this with your answer
User alice
tries the following command.
echo "another line" >> /tmp/top-dir/msg
Change this with your answer
umask
Why is the umask 0000
command unsafe?
*Change this with your answer*