0% found this document useful (0 votes)
19 views

Lab2 Assignment

Uploaded by

Weam Alzhrani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Lab2 Assignment

Uploaded by

Weam Alzhrani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Lab#2 Assignment:

1. The Virtual File System (VFS)


1. List the contents of your home directory recursively. You can use either ~ or $HOME
to refer to your home directory from the shell. pipe the output to show less using
Command | less.
2. List all files, including hidden files and directories, in your home directory, non-
recursively. Hidden files or directories are those that begin with a dot and are not usually
shown in ls output.
3. List the contents of /lib using ls -l /lib.
4. List the files in your home directory, with file sizes shown with human-friendly units (ie.
bytes, kilobytes, megabytes, gigabytes).
5. List the info about a directory, and only that directory, without ls recursing into that
directory. In other words, the permissions etc. of the directory itself, not the contents of
the directory.

2. Filesystem Permissions

1. Fill in the blanks to convert between octal and symbolic notation; all but the last two you
would be likely to find on a real system.

Octal Symbolic
644
rwxr-xr-x
1777
rwsr-xr-x
3070
---rwS---

2. Assume you see a directory which ls -l describes as drwxrwsr-x. Write a paragraph to


completely describe the effect of this permission set.
3. Give a typical default umask value and describe its effect.
4. Calculate the default permission set for files after applying the umask value.

Umask value Octal notation Symbolic notation


002 775
022 rwxr-xr-x
026 751
027 rwxr-x--
077 700

3. Archival and Backup

1. Create a backup of your home directory (/home/yourname), storing it in /tmp/


mybackup.tar.gz. Set the permissions such that only you can read it. Use good method
not the bad method.
2. The above command likely has a security problem, in that the archive does not have a
suitable mode when it is being created. This creates a window of opportunity for
someone to open the file and read the contents before tar has finished and you have fixed
the permissions.

How can you fix this problem? (Hint: use umask).

Your document should be submitted in a pdf format with the following sections:

1. A cover page outlining student names, Numbers, Group Number.


2. Write the question, then a screenshot for output.

You might also like