summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md35
1 files changed, 34 insertions, 1 deletions
diff --git a/README.md b/README.md
index a970613..8f9c21e 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@ Be sure to complete the final step—click on the Send for Marking button to not
## Solve problems 7–11 and 15–17 at the end of Chapter 7.
7. Give three commands that you can use to list the absolute pathname of your home directory.
+
```bash
モ cd
モ pwd
@@ -23,6 +24,8 @@ Be sure to complete the final step—click on the Send for Marking button to not
/Users/mokha
```
+See `exercises/chapter-7.7`.
+
8. Write down the line in the /etc/passwd file on your system that contains information about your login. What are your login shell, user ID, home directory, and group ID? Does your system contain the encrypted password in the /etc/passwd or /etc/shadow file?
```bash
@@ -50,10 +53,17 @@ shell: bash
Password is stored in `/etc/shadow`
+See `exercises/chapter-7.8`.
+
9. What would happen if the last field of the line in the /etc/passwd file were replaced with /usr/bin/date? Why?
The login shell would become the date command. The `date` program prints the date. This would print the date and end.
+```bash
+も date
+Wed May 22 20:07:38 MDT 2019
+```
+
10. What are the inode numbers of the root and your home directories on your machine? Give the commands that you used to find these inode numbers.
```bash
@@ -61,6 +71,8 @@ ls -id /
ls -id $HOME
```
+See `exercises/chapter-7.10`.
+
11. Create a directory, called memos, in your home directory. Go into this directory and create a file memo.james by using one of the editors discussed in Chapter 5. Give three pathnames for this file.
```bash
@@ -76,6 +88,8 @@ bash-3.2$ ls /Users/mokha/memos/memo.james
/Users/mokha/memos/memo.james
```
+See `exercises/chapter-7.11`.
+
15. Give the command for deleting the memos directory. How do you know that the directory has been deleted?
```bash
@@ -84,6 +98,8 @@ bash-3.2$ rm -fr memos/
bash-3.2$ ls -alh memos
```
+See `exercises/chapter-7.15`.
+
16. Why does a shell process terminate when you press <Ctrl-D> at the beginning of a new line?
```text
@@ -119,6 +135,8 @@ chapter8.eps: empty
chapter9.eps: empty
```
+See `exercises/chapter-7.17`.
+
## Solve problems 7–17 at the end of Chapter 8.
7. How do the read, write, and execute permissions work in UNIX? Illustrate your answer with some examples.
@@ -164,6 +182,8 @@ staff everyone localaccounts _appserverusr admin _appserveradm _lpadmin com.appl
wheel daemon kmem sys tty operator procview procmod everyone staff certusers localaccounts admin com.apple.sharepoint.group.1 _appstore _lpadmin _lpoperator _developer _analyticsusers com.apple.access_ftp com.apple.access_screensharing com.apple.access_ssh com.apple.sharepoint.group.2
```
+See `exercises/chapter-8.8`.
+
9. Create a file test1 in your present working directory and set its access privileges to read and write for yourself,
read for the users in your group, and none to everyone else.
What command did you use to set privileges?
@@ -178,6 +198,8 @@ chmod u=rw,g=r,o= test1
-rw-r----- 1 mokha staff 0B 18 May 18:17 test1
```
+See `exercises/chapter-8.9`.
+
10. The user ‘sarwar’ sets access permissions to his home directory by using the command chmod 700 $HOME.
If the file cp.new in his home directory has read permissions to 777, can anyone read this file? Why or why not? Explain your answer.
@@ -189,7 +211,18 @@ for all other users.
| x | x | x |
11. What is the effect of each command? Explain your answers.
-a. chmod 776 ∼/lab5
+
+The following will change the permissions for a file named `lab5` in the
+`$HOME` directory to:
+
+* read, write, execute for the owner (4 + 2 + 1 = 7)
+* read, write, execute for the group (4 + 2 + 1 = 7)
+* read and write for everyone (4 + 2 = 6)
+
+```bash
+chmod 776 ∼/lab5
+```
+
b. chmod 751 ∼/lab?
c. chmod 511 *.c
d. chmod 711 ∼/*