UNIX/Linux Chapter 4 Exercise Questions

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

4.7 Assuming that a file's current permissions are rw-r-xr--, specify the chmod expression required to change them to (i) rwxrwxrwx, (ii) r--r-----, (iii) ---r--r-- , (iv) ---------, using both relative and absolute methods of assigning permissions.

(i) [chmod 777 [filename]] in absolute and [chmod a=rwx [filename]] in relative. (ii) [chmod 440 [filename]] in absolute and [chmod ug=r, o-rwx [filename]] in relative. (iii) [chmod 044 [filename]] in absolute and [chmod u-rwx [filename], go=r [filename]] in relative. (iv) [chmod 000 [filename] in absolute and [chmod ugo-rwx [filename]] in relative.

4.28 Explain the difference between (i) ls -l and ls -lt, (ii) ls -lu and ls -lut.

(i) [ls -l] simply displays files and directories in a list format with detailed information like the permissions, owner, group, and modification time, and other information. [ls -lt] organizes the list of information by time of their modification. (ii) [ls -lu] will sort the files and directories by ASCII collating sequence but will show the last access time for the files and directories. [ls -lut] will display a listing for the files by last access time of the files and directories.

4.5 From the security viewpoint, explain the consequences of creating a file with permissions (i) 000, (ii) 777.

(i)If you create a file with 000 Permissions That would mean that no one would be able to read to it wright to it or execute it. Only the root user will be able to read it. This is also with taking in to consideration what the default umask is set to. If no one has access to the system they will not be able to read, execute and create and modified the files and directories that they need to be productive in their respective jobs. This would defeat the purpose of having the system in the first place. The only reason that you might want everything set to no permissions for all users would be possible if your storing the data and don't intend to use it or if the only person accessing the data will be the super user. (ii) If you create a file with 777 Permissions Then everyone in user, group and other will have all available permissions for the file with also taking in to consideration whatever the default umask is set to. If everyone has access to all files and directory's sensitive information, files and directories can be copied, deleted, and moved by anyone that has access the system.

4.13 If the owner doesn't have write permission on a file but her group has, can she (i) edit it, (ii) delete it?

(i)she can not edit the file if she doesn't have right permissions. She needs to a member of the group that has the write permissions to make modifications to the file. (ii)She can delete the file as long as she and the group that she belongs to has write permissions for the directory that the file resides in.

4.22 Explain the significance of fast symbolic links and dangling symbolic links.

A fast symbolic link is something that Linux uses. Normally the pathname is stored in the symbolic link is resides on the disk, but for the case of Linux the path name is stored on the inode and must not exceed 60 characters. A dangling symbolic link is one that no longer points to a viable file. The file that the symbolic points to has been deleted and points to a nonexistent file.

4.26 What are the three time stamps maintained in the inode, and how do you display two of them for the file foo?

The three time stamps are... -Time of last file modification Displayed by.... [ls -l foo] -Time of last access Displayed by.... [ls -lu foo] -Time of last inode modification Displayed by.... [ls -lc foo]

4.25 The owner can change all attributes of a file on a BSD-based system. Explain whether the statement is true or false. Is there any attribute that can be changed only by the superuser?

This is not true. On BSD-based systems only the super user can change all attributes of a file with the command [chown]. The command [chgrp] can be used for by a user to change to a group that they are already assigned to but not anything else.

4.4 Create a file foo. How do you assign all permissions to the owner and remove all permissions from others using (i) relative assignment and (ii) absolute assignment? Do you need to make any assumptions about foo's default permissions?

To assign all permissions to the owner and remove all from other in a relative manner you would use the command [chmod u+rwx foo, go-rwx foo] and for absolute assignment you would use the command [chmod 700 foo]. You also must take into consideration what the system default is currently and what the umask is set to.

4.17 If ls -li shows two filenames with the same inode number, what does that indicate?

When you see two files both with the same inode number it means that they are linked to gather. We call this a hard link and is invoked by using the command [ln [originalfile] [filetolink]].

4.2 Does the owner always belong to the same group as the group owner of a file?

Yes the owner always does belong to the same group as the group owner.

4.19 How can you make out whether two files are copies or links?

You can tell weather a file is a copy or link by looking at the information listed in the [ls -li] command. This will display the inode information. If you have a hard link you will see two different names for a file, but they will have the same inode number. If you have a softlink/symbolic link you will see a different inode number for the file because it is just a direct link to the original file and not a copy of it. If you delete a symbolic link file you will delete the original files data.

4.27 How can you find out whether a program has been executed today?

You can use the command [ls -lu] which will display the last access time which includes the executed time of the day.

4.9 You tried to copy a file foo from another user's directory, but you got the error message cannot create file foo. You have write permission in your own directory. What could be the reason, and how do you copy the file?

You might not have the permissions to copy the file from the original user's directory. You would have to ask the admin of the group or the super user to change the permissions in the directory to allow you to copy the file to the directory that you need to.

4.15 The UNIX file system has many root directories even though it actually shows one. True or false?

The UNIX file system my have multiple file systems that may appear to be just one root directory. These multiple files systems are "mounted" to the main root directory at boot and will share some of the combined system files that are required for the UNIX system to work.

4.1 A file in a file system with a block size of 1024 bytes contains 1026 bytes. How many bytes of disk space does it occupy?

Due to how the filing system works with handling data It would occupy 2 blocks. That would be 2048 Bytes.

4.12 If a file has the permissions 000, you may or may not be able to delete the file. Explain how both situations can happen. Does the execute permission have any role to play here?

If a file has the permissions of 000 you may be able to delete the file if the directory is still set to have wright permissions. If the directory is set to no writer permissions, you will not be able to delete the file.

4.10 What do you do to ensure that no one is able see the names of the files you have?

In order to prevent a user from being able to view the files that you have you would have to change the permissions of the directory that those files reside in and only allow read permissions to you and know one else.

4.11 The command cd bar failed where bar is a directory. How can that happen?

In the case that the command cd bar fails it could be possible that you do not have executable privileges to the directory that bar exists in.

4.8 Use chmod -w . and then try to create and remove a file in the current directory. Can you do that? Is the command the same as chmod a-w foo?

In the case that you use [chmod -w] you would not be able to create additional directory's and or files under this current directory. The command [chmod a-w foo] is a longer hand way of doing the same thing and specifying the target file instead of the current directory.

4.21 You have a number of programs in $HOME/progs which are called by other programs. You have now decided to move these programs to $HOME/internet/progs. How can you ensure that users don't notice this change?

Just make a hard links for those files in the new directory that you want put them in and the other users will not notice the change and will still be able to access them without any problems.


Kaugnay na mga set ng pag-aaral

Individual Life Insurance Contract - Provisions and Option

View Set

Chapter 24 Masonry Materials-I (Mortar and Brick)

View Set

ISA235 Exam Ch1 terms / responses

View Set