From 8a1bbcba87729f8eef3e99159b5253a67243bb17 Mon Sep 17 00:00:00 2001 From: mo Date: Sat, 25 May 2019 13:34:51 -0600 Subject: redo 8.14 --- README.md | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 451bfc1..a687fd2 100644 --- a/README.md +++ b/README.md @@ -304,12 +304,12 @@ The `umask` indicates which permission bits to turn off. ie. `777 - mask`. To change the default umask to `037`. ```bash -$ touch before +$ mkdir -p before $ umask 037 -$ umask after +$ mkdir -p 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 +drwxr-----. 2 root root 4.0K May 25 19:31 after +drwxr-xr-x. 2 root root 4.0K May 25 19:31 before ``` The default access privileges are: @@ -334,6 +334,23 @@ 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? +I can use the `umask` builtin to set the default access privileges. I +can test this by creating a file before the change and then creating a +file after the change. Then I can list the permissions for both the +before and after files to witness the difference. I can also run `umask` +to see what the current setting is. + +To change the default access privileges to `rwx|r-x|---` (750) I can use the +formula: + +```text +777 - 750 = 027 +``` + +The desired `umask` value would be `027`. + +See `exercises/chapter-8.15`. + 16. Give chmod command lines that perform the same tasks that the mesg n and mesg y commands do. (Hint: Every hardware device, including your terminal, has an associated file in the /dev directory.) 17. What are the purposes of the set-user-ID (SUID), set-group-ID (SGID), and sticky bits? -- cgit v1.2.3