CYB202_Lab4
CYB202_Lab4
5. If newfile is not in the /home directory, the find command will not find it. The
time taken will depend on the size of the /home directory, but it should be
quicker than searching from the home directory.
6. If `newfile` is in `/home`, the `find` command will find it quickly due to the
smaller search scope.
7. The which command will find grep because it is a standard utility included in
the system PATH.
8. These commands may return more information than which, as they provide
additional context or locations for the command.
11. Lists all zero-size files on the entire system, displayed one screen at a time
for easier viewing.
Project 4-6
Objective: Remove files and directories
Explanation: I deleted files and directories using the rmdir and rm commands
successfully.
3. Both directories are empty, they will be deleted successfully; otherwise,
rmdir will fail because it can only remove empty directories.
4. The message will be along the lines of rm: remove regular file 'sample1' for
each file. Answering 'n' means the files will not be deleted.
5. I would not prompt because the -f option forces the removal. All three files
were deleted successfully. Another command that can be used to delete a file in
Linux is unlink.
6. The samples directory is not empty; I got an error message like rmdir: failed
to remove 'samples': Directory not empty.
7. The samples directory and all files within it are deleted successfully without
any prompts.
Project 4-7
Objective: Set access permissions
Explanation: I applied and modified access permissions on files and directories
and tested their effects successfully.
3. The output shows the file permissions. The first set of characters indicates the
read, write, and execute permissions for the owner, group, and others.
4. No one has read, written, or executed permissions on the file permsample.
The permissions will show as ----------.
5. Yes, I was able to delete the file permsample because the -f option forces the
removal regardless of the file's permissions.
6. The current directory is / and the directories under / are listed.
7. The owner and group owner of the foruser1 directory are displayed. If logged
in as home, I would be in the "user" category with the permissions listed for the
owner.
8. Initially, lists files in the /home directory, copies the hosts file from /etc to the
current directory, and then lists the contents again to confirm the hosts file is
present.
10. The success of cd /home depends on existence and permissions.
Successfully changed into /home
I didn’t get any error with rm -f hosts are due to the file is already existing or
permissions are not restricted.
16. Typically shows additional ACL entries beyond user, group, and other.
17. Yes, ‘+’ symbol following the mode, indicating extended ACLs.
Useful for providing specific users or groups with different access levels to a
file or directory, without altering standard Unix permissions.
18. No, there won't be a `+` symbol following the mode after running `setfacl -b
aclfile`.
Project 4-11
Objective: Set filesystem attributes
Explanation: I have successfully configured and researched filesystem
attributes.
2. Shows filesystem attributes set on toughfile by default, typically none (--------
-----).
3. Sets the immutable attribute (i) on toughfile.
4. The vi editor warns that the file is read-only due to the immutable attribute.
Changes cannot be saved using w!
5. Unable to delete toughfile due to the immutable attribute.
6. Removes the immutable attribute (i) from toughfile.
7. Setting the +c attribute on a file tells the Linux kernel to compress and
decompress the file transparently as it is written to and read from the filesystem,
helping to save disk space.
Setting the +s attribute ensures that when a file is deleted, its data blocks are
immediately overwritten, making it harder to recover deleted data using file
recovery tools.