PuTTY

fahadhero
ceglab2.pdf

Question 1 (0.5 points)

Select all of the following statements that are true. Correct statements are quotes or

paraphrases from this lab's Introduction. Incorrect statements will not be found in this lab's

introduction.

Question 1 options:

In both Windows and Linux, a soft link can identify a file or directory on a remote server.

Linux internally identifies every file with an i- number. Two different files within the same file system volume will have different i-numbers. There is a one-to-one correspondence between files and i-nodes.

In almost every file system, files form a hierarchical tree - all internal nodes are directories, all ordinary files are leaves, and some leaf nodes are empty directories.

In many Unix/Linux file systems, every directory is a file. So, when we wish to discuss a non- directory file we sometimes use the term "ordinary" file.

It is possible to have one physical disk partition shared by multiple operating systems simultaneously.

In many Unix/Linux file systems, every Unix/Linux file (including directories) has a parent directory that it belongs to. Every directory contains two special entries: (i) the dot, '..', refers to itself -- a self-loop; and (ii) the dot-dot, '.', refers to the parent directory.

Many different file systems exist. Some conserve storage space more effectively than others. Some provide better security features than others. Some enable faster access to file content than others.

File systems do not restricts the characters that may appear in file name base names.

In Linux, hard links can cross file systems.

A directory should be thought of as a table of two columns: first column lists the names of files, and the second lists the corresponding i-number. The internal order of the rows of this table is unimportant.

An i-node is an index into a table that contains metadata such as the locations of a file's contents on a Hard Disk Drive (HDD).

The bytes stored by a file typically do not have any particular meaning to a file system. The bytes are only meaningful to users or programs that read the file's contents.

Save

Question 2 (0.5 points)

Select all of the following statements that are true. Correct statements are quotes or

paraphrases from this lab's Introduction. Incorrect statements will not be found in this lab's

introduction.

Question 2 options:

On Linux, any user can create temporary files in /tmp.

Unix style configuration settings the for the whole system are typically stored in /etc. Windows has the Registry for a similar purpose.

A time stamp is internally stored by the OS using a special representation. In Windows, time is a 64-bit value that represents the number of 1 nanosecond intervals that have elapsed since 12:00 A.M. January 1, 1901.

The mkdir command exists in both Windows and Linux to creates directories. In Linux, the mv command moves a file from one location in a file system to another. In Linux, the cpcommand copies a file from one location in a file system to another without changing or moving the original file that was copied.

For Linux file systems, every file has three sets of permissions. One set applies to the user who owns the file ("u"), one set applies to the file's group ("g"), and one set applies to all other users on the system ("o"). For example, a file can be readable by everyone but writable only by the users belonging to that file's group. Permissions are changed by the chmod utility. Ownership is changed by the chown utility.

Many Windows and Linux programs depend on recognizing the type of a file based on the file name extension of the file.

For almost every Linux file system, there are at least three basic permissions: read ("r"), write ("w"), and execute ("x"). Users are allowed to perform these operations on a file if and only if the corresponding permission is set for them on that file

A file has three important time stamps that all OSes provide. The creation time stamp refers to when the file was originally created. The modification time stamp refers to the when the file was last modified. The last-access time refers to when was it last accessed for either reading/writing. If the last access was reading, it is obviously later than the modification time stamp. If the last access was writing, it is equal to the modification time stamp.

Windows NTFS has read, write, etc. permissions. These are typically handled in the Properties tabs sheet of a file. At the command line level, the two relevant commands are attrib and icacls. An access control list explicitly enumerates each user and the granted/denied privileges.

In both Linux, ls -l, and in Windows, dir, show modification time stamps in human readable form adapted to the local time zone (e.g. Eastern Standard/Daylight Time).

In PowerShell, multiple steps are necessary to change the ownership of a file or directory.

In Linux, the cp -r program copies all of the files in a specified directory but does not copy files in any subdirectories of the specified directory.

Save

Question 3 (2 points)

On thor, cd to your home directory. Create a new directory named tmp. Then cd into tmp

and stay there in the rest of the steps for this question.

Note: The -aiR options to the ls command tell ls to show the i-node number for each file

and recursively show all files.

Create three sub-directories of tmp named D1, D2, D3. Create a file named aiRA.txt as

follows:

ls -aiR > aiRA.txt

Establish to aiRA.txt a hard link named ls1.txt in D1 and a soft link ls2.txt in D2. Establish

inside D3, a soft link named ls3.txt to the ls2.txt file you now have in D2.

Create a file named aiRB.txt as follows:

ls -aiR > aiRB.txt

Now, delete aiRA.txt.

Create a file named iRC.txt as follows:

ls -aiR > aiRC.txt

Question 3 options:

After completing all of the steps for this question, the following command outputs "22" without the quotes: wc -l < ~/tmp/D2/ls2.txt Note, the '~' character means "home directory".

After completing all of the steps for this question, part of the output of following command is "No such file or directory" without the quotes: less ~/tmp/D3/ls3.txt Note, the '~' character means "home directory".

After completing all of the steps for this question, the following command shows that a file named ls3.txt exists in the D3 directory: ls -l ~/tmp/D3

After completing all of the steps for this question, the file ~/tmp/aiRC.txt shows that a file named ls3.txt exists in the directory named D3.

After completing all of the steps for this question, examine the aiRB.txt file using your favorite editor or less. The .. entry in the D1 directory has the same i- node as the . entry in ~/tmp.

After completing all of the steps for this question, examine the aiRB.txt file using your favorite editor or less. The ls1.txt entry in the D1 directory has the same i-node as the aiRA.txt entry in ~/tmp.

After completing all of the steps for this question, examine both the aiRC.txt and aiRB.txtfiles using your favorite editor or less. In aiRB.txt, the ls1.txt entry in the D1 directory has a different i-node than the ls1.txt entry in the D1 directory listed in the aiRC.txt file.

After completing all of the steps for this question, the symbolic link, ls2.txt, was broken when the aiRA.txt file was deleted.

After completing all of the steps for this question, the symbolic link, ls3.txt, was notbroken when the aiRA.txt file was deleted because ls3.txt is a symbolic link to ls2.txt.

After completing all of the steps for this question, the following command shows the contents of ~/tmp/D1/ls1.txt, and it works because even though the file aiRA.txt was deleted, the hard link in D1 still references the i-node of the aiRA.txt file. The storage for the aiRA.txt file was not actually deleted. less ~/tmp/D1/ls1.txt

Save

Question 4 (3 points)

Complete all of the steps for the previous question before performing the following actions:

1) Create a file named myDarkestSecret.txt inside the ~/tmp directory you previously

created. One way to creat the file is the following:

echo "I secretly enjoy Glee" > ~/tmp/myDarkestSecret.txt

2) Change the permissions on ~/tmp/myDarkestSecret.txt so that only you can read the file.

(so nobody without superuser credentials on thor can read it) Run the following command:

ls -l ~/tmp/myDarkestSecret.txt > ~/tmp/permissions.txt

3) Execute the following command by replacing username with your actual username on

thor:

tar -czf /tmp/username.tgz ~/tmp

The tar program stands for "tape archive" and dates back to the days when magnetic tapes

were the most common digital stoarage format. The options, -czf, stand for "create",

"compress in zip format", and "read from the specified file path". The above command

creates a new compressed file containing all of the files in your private ~/tmp directory and

stores the compressed file in the shared /tmp directory. Note: other users can see your

compressed file in /tmp, and depending on the permissions you assign to the file, they

make be able to read the contents of the compressed file too.

4) Move /tmp/username.tgz (where username is your actual username on thor) to your

home directory ~. Use the mv command.

5) Copy username.tgz (where username is your actual username on thor) to a Windows

computer using WinSCP or your favorite file transfer tool.

6) Uncompress username.tgz on the Windows computer using your favorite Windows

application for uncompressing files. There is one installed on all of WSU's computers. You

can download the free Winzip or 7Zip programs if you prefer.

Select all of the following statements that are true:

Question 4 options:

The myDarkestSecret.txt file that your carefully protected from prying eyes is now readable by anyone who uncompresses username.tgz (where username is your actual username on thor) on Windows.

File permissions assigned on Linux do not automatically transfer to Windows when using tar.

Use man to find the answer: The -e option for the Linux zip program encripts files while compressing them. Encrypted files cannot be easily uncompressed unless the encryption password used to create the zip file is know.

  • Question 1 (0.5 points)
  • Question 2 (0.5 points)
  • Question 3 (2 points)
  • Question 4 (3 points)