Question

Create a directory dir1 • Create a file file1 in dir1 • Go to home directory...

Create a directory dir1

• Create a file file1 in dir1

• Go to home directory

• Remove owner write permission permission for dir1

• Go to dir1

• Remove file1

Explain your observation?

Note: If you don't have write permission for a directory, then you can't delete a file in the directory. If you have write access to the file you can update the data in the file.

Homework Answers

Answer #1

First we perform the following steps:

1. Create a directory dir1
2. Create a file called file1 in dir1
3. Go back to home directory
4. Remove owner's write permission permission for dir1
5. Go inside to dir1

Now when we try to remove the file1 we will get the error as follows:

rm: cannot remove 'file1': Permission denied

The reason is as follows:

Although you still have the write property of file file1, deleting it means you are making changes to the directory dir1 it resides in, not the file itself. This is because a file is just an inode, and the directory refers to that inode. By removing it, you are just removing a reference to that file's inode in the directory. So the owner is changing the directory dir1 and not the file file1, hence the error.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Linux Operation SECTION 2 – File and Directory Permissions: FILE PERMISSIONS: What is the command used...
Linux Operation SECTION 2 – File and Directory Permissions: FILE PERMISSIONS: What is the command used to find out which user account you are logged into?      . This command may come in handy in the following exercises. Ensure you are in your home directory of the student1 account. Use the echo command with output redirection to create a file called labfile4 and put the following text in this file: “This is the first line of labfile4”. Using the symbolic notation...
Linux, please avocado is an empty file Q14 – Specify a single line command that gives...
Linux, please avocado is an empty file Q14 – Specify a single line command that gives the owner and group permission to execute the file avocado while giving the owner sole permission to read and write the file. Do not change any other permission, i.e., do not remove permission from others to execute the file, if they already have that permission. Q15 – File/directory permissions are subject to permissions on the parent directories. For example, consider the file /home/dv35/cs265/lab1.txt. If...
Assume you are at your home directory: Write the commands: Create a directory DR1 Change to...
Assume you are at your home directory: Write the commands: Create a directory DR1 Change to DR1 Create DR2 in DR1 Change to DR2 Also answer the following: What will each command do :    5. enter cd .    6. enter   cd ..    7. enter    cd
PART 4: Learn about commands to navigate the directory tree structure: use the ls –ali /  ...
PART 4: Learn about commands to navigate the directory tree structure: use the ls –ali /   command to review the contents of the / directory Review the Linux Filesystem Standard (FSSTD) and document the following directories’ contents / ------- |--bin |--boot               |--dev               |--etc |--home               |--lib               |--mnt               |--opt               |--root               |--sbin               |--tmp               |--usr               |--var 3. use the cd etc  OR cd /etc  to change your default directory to the etc directory 4. use the...
Write Linux command lines to do the following: 1. Create a directory with name “yourName_ID” 2....
Write Linux command lines to do the following: 1. Create a directory with name “yourName_ID” 2. Create a file with name “yourLastName.txt” inside the directory created in step.1 3. Write inside the created file exactly the following content (you may use editors such as vim, pico, ….): Linux Lab Lab. ToDo#1 Summer Semester 2019/2020# 4. Display the first 2 lines of the file. 5. Change the permission of the file to read write and execute for owner, groups and others....
What's appropriate setting for your home directory if you want to share some subdirectories, but don't...
What's appropriate setting for your home directory if you want to share some subdirectories, but don't want the anyone else to browse, add or remove entries in your home directory. 1. 700 2. 744 3. 755 4. 711
IN LINUX answer the following with what you would type to get the desired result. Change...
IN LINUX answer the following with what you would type to get the desired result. Change the permissions of the /home/shared/salesproject/ folder itself, allowing the owner and group full access, with no access for anyone else on the system. Log in as "susan" (password "secret") and make sure she can access the /home/shared/salesproject/ directory and files within. Create a file in /home/shared/salesproject/ as susan. What are the owner, group, and mode of the file she created? Log in as "sam"...
Create a stadium class. The class header file content (.h file) can go in this question,...
Create a stadium class. The class header file content (.h file) can go in this question, the class implementation (.cpp file) can go in the following question, and the main.cpp content can go in the third question. static data members: starting seat number next seat number data members: stadium name name of home team current opponent seats sold (vector of seat numbers) member functions: custom constructor - take input of stadium name default constructor get next seat number (static) change...
Suppose that you are a superuser on a Linux system, and there is a file “/home/bob/foo”,...
Suppose that you are a superuser on a Linux system, and there is a file “/home/bob/foo”, which is owned by an ordinary user Bob. You need to give a permission to read this file to an ordinary user Alice, but no one else (of course, you as superuser will be able to read it too). Explain how you will do it. Note: You do not have to provide specific commands, just a short description will suffice.
drwxr-xr-x 10 mst staff 320 Sep 18 14:58 Sites drwxr-xr-x 2 mst staff 64 May 28...
drwxr-xr-x 10 mst staff 320 Sep 18 14:58 Sites drwxr-xr-x 2 mst staff 64 May 28 2017 VirtualBox VMs -rw-r--r-- 1 mst staff 633 Dec 11 2019 balance.pl drwxr-xr-x 4 mst staff 128 Oct 11 2014 bin -rw-r--r-- 1 mst staff 473 Dec 13 2019 bitshift.py For this problem, we are mainly concerned with the set of access permissions, which appears at the beginning of the line for each file or directory. Directories have a "d" at the beginning of...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT