\begin{exe} {Using Access Control Lists}

   \begin{enumerate}
      \item
      Create a file using your usual user name and run \textbf{getfacl}
      on it to see its properties.
      \item
      Create a new user account with default properties (or reuse one
      from previous exercises.
      \item
      Login as that user and try to add a line to the file you
      created in the first step.  This should fail.
      \item
      User \textbf{setfacl} to make the file writeable by the new user
      and try again.
      \item
      User \textbf{setfacl} to make the file not readable by the new user
      and try again.

      \item
      Clean up as necessary
   \end{enumerate}
   \begin{sol}

      It is probably easiest to open two terminal windows, one to
      work in as your normal user account, and the other as the
      secondary one.
      \begin{enumerate}
         \item
         In window 1:
         \begin{cmd}
$ echo This is a file > /tmp/afile
$ getfacl /tmp/afile
         \end{cmd}
         \begin{response}
getfacl: Removing leading '/' from absolute path names
# file: tmp/afile
# owner: coop
# group: coop
user::rw-
group::rw-
other::r--
         \end{response}
         \item
         In window 1:
         \begin{cmd}
$ sudo useradd fool
$ sudo passwd fool
...
         \end{cmd}
         \item In window 2:
         \begin{cmd}
$ sudo su - fool
$ echo another line > /tmp/afile
         \end{cmd}
         \begin{response}
-bash: /tmp/afile: Permission denied
         \end{response}
         \item
         In window 1:
         \begin{cmd}
$ setfacl -m u:fool:rw /tmp/afile
$ getfacl /tmp/afile
         \end{cmd}
         \begin{response}
getfacl: Removing leading '/' from absolute path names
# file: tmp/afile
# owner: coop
# group: coop
user::rw-
user:fool:rw-
group::rw-
mask::rwx
other::r--
         \end{response}
         In window 2:
         \begin{cmd}
$ echo another line > /tmp/afile
         \end{cmd}
         \item
         In window 1:
         \begin{cmd}
$ setfacl -m u:fool:w /tmp/afile
         \end{cmd}
         In window 2:
         \begin{cmd}
$ echo another line > /tmp/afile
-bash: /tmp/afile: Permission denied
         \end{cmd}
         \item Cleaning up:
         \begin{cmd}
$ rm /tmp/afile
$ sudo userdel -r fool
         \end{cmd}

      \end{enumerate}
   \end{sol}
\end{exe}

