summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo <mo.khan@gmail.com>2019-05-25 13:10:05 -0600
committermo <mo.khan@gmail.com>2019-05-25 13:10:05 -0600
commit4e8ce2f5cc8209bedd5d00a3ad5ede1c1620523e (patch)
tree45b1e884d434d7a68b4a4c2f6a1a9ba99395db42
parent1fc7af73dcb50d309c0f53a7c6081f92f3f2a0cd (diff)
complete 8.14
-rw-r--r--README.md35
-rw-r--r--exercises/chapter-8.1415
2 files changed, 49 insertions, 1 deletions
diff --git a/README.md b/README.md
index c1037a1..451bfc1 100644
--- a/README.md
+++ b/README.md
@@ -297,7 +297,40 @@ $ cp /etc/passwd dir1
See `exercises/chapter-8.13`.
-14. What umask command should be executed to set the permissions bit mask to 037? With this mask, what default access privileges are associated with any new file that you create on the system? Why? Where would you put this command so that every time you log on to the system this mask is effective?
+14. What `umask` command should be executed to set the permissions bit mask to `037`? With this mask, what default access privileges are associated with any new file that you create on the system? Why? Where would you put this command so that every time you log on to the system this mask is effective?
+
+The `umask` indicates which permission bits to turn off. ie. `777 - mask`.
+
+To change the default umask to `037`.
+
+```bash
+$ touch before
+$ umask 037
+$ umask after
+$ ls -alh before after
+-rw-r-----. 1 root root 0 May 25 19:03 after
+-rw-r--r--. 1 root root 0 May 25 19:03 before
+```
+
+The default access privileges are:
+
+```text
+777 - 037 = 740
+
+rwx|r--|---
+```
+
+User: Read, write, execute.
+Group: Read
+Everyone: no access
+
+The `umask` can be placed in any startup scripts such as:
+
+* $HOME/.profile (System V UNIX)
+* $HOME/.login (BSD UNIX)
+* $HOME/.bash\_profile
+
+See `exercises/chapter-8.14`.
15. Give a command line for setting the default access mode so that you have read, write, and execute privileges, your group has read and execute permissions, and all others have no permission for a newly created executable file or directory. How would you test it to be sure that it works correctly?
diff --git a/exercises/chapter-8.14 b/exercises/chapter-8.14
new file mode 100644
index 0000000..172cfdd
--- /dev/null
+++ b/exercises/chapter-8.14
@@ -0,0 +1,15 @@
+Script started on 2019-05-25 13:08:45-06:00 [TERM="screen-256color" TTY="/dev/pts/7" COLUMNS="238" LINES="13"]
+bash-5.0$ docker run -it fedora /bin/bash
+]0;@d8fb6f3d47d3:/[root@d8fb6f3d47d3 /]# [root@d8fb6f3d47d3 /]# cd
+]0;@d8fb6f3d47d3:~[root@d8fb6f3d47d3 ~]# touch before
+]0;@d8fb6f3d47d3:~[root@d8fb6f3d47d3 ~]# umask 037
+]0;@d8fb6f3d47d3:~[root@d8fb6f3d47d3 ~]# touch after
+]0;@d8fb6f3d47d3:~[root@d8fb6f3d47d3 ~]# ls -alh before after
+-rw-r-----. 1 root root 0 May 25 19:09 after
+-rw-r--r--. 1 root root 0 May 25 19:08 before
+]0;@d8fb6f3d47d3:~[root@d8fb6f3d47d3 ~]# exit
+exit
+bash-5.0$ exit
+exit
+
+Script done on 2019-05-25 13:09:08-06:00 [COMMAND_EXIT_CODE="0"]