From a7acdb07175e2a918d04541e714d4cf13892397f Mon Sep 17 00:00:00 2001 From: mo Date: Wed, 22 May 2019 20:34:47 -0600 Subject: complete 8.13 --- README.md | 37 ++++++++++++++++++++++++++++++++----- exercises/chapter-8.13 | 14 ++++++++++++++ 2 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 exercises/chapter-8.13 diff --git a/README.md b/README.md index d06f593..870d624 100644 --- a/README.md +++ b/README.md @@ -281,11 +281,38 @@ $ ls -ld ∼/personal ``` 12. What does the execute permission mean for a directory, a file type for which the execute operation makes no sense? -13. Create a file dir1 in your home directory and use cp /etc/passwd dir1/mypasswd command to copy the /etc/passwd file in it. Use the chmod command to have only the search permission on for it and execute the following commands. What is the results of executing these commands? Do the results make sense to you? Explain. -a. cd dir1 -b. ls -c. rm dir1/mypasswd -d. cp /etc/passwd dir1 + +The execute permission on a directory allows you to enter it. .ie. `cd directory`. + +13. Create a file `dir1` in your home directory and use `cp /etc/passwd dir1/mypasswd` command to copy the `/etc/passwd` file in it. +Use the `chmod` command to have only the search permission on for it and execute the following commands. + +What is the results of executing these commands? Do the results make sense to you? Explain. + +Change directory to a directory named `dir1`. + +```bash +$ cd dir1 +``` + +List the contents of the current directory. +```bash +$ ls +``` + +Remove the file named `mypasswd` from the directory named `dir1`. + +```bash +$ rm dir1/mypasswd +``` + +Copy the file from `/etc/passwd` to the directory named `dir1`. +```bash +$ 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? 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? 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.) diff --git a/exercises/chapter-8.13 b/exercises/chapter-8.13 new file mode 100644 index 0000000..5878854 --- /dev/null +++ b/exercises/chapter-8.13 @@ -0,0 +1,14 @@ +Script started on 2019-05-22 20:29:07-06:00 [TERM="screen-256color" TTY="/dev/pts/3" COLUMNS="238" LINES="13"] +bash-5.0$ mkdir -p ~/dir1 +bash-5.0$ cp /etc/passwd ~/dir1/mypasswd +bash-5.0$ chmod +x ~/dir1/ +bash-5.0$ cd ~/dir1/ +bash-5.0$ ls +mypasswd +bash-5.0$ cd .. +bash-5.0$ rm dir1/mypasswd +bash-5.0$ cp /etc/passwd dir1 +bash-5.0$ exit +exit + +Script done on 2019-05-22 20:30:23-06:00 [COMMAND_EXIT_CODE="0"] -- cgit v1.2.3