Review Questions and Answers

1. 

You are the Solaris administrator for your network. One of your servers has a public directory named forsale, containing classified ads posted by employees. You want to ensure that employees can post files to the directory but cannot delete files unless they are the owner. A user named jsmith is the owner of the directory, and the employee group, which contains all employees, is the group owner. Which commands can you execute to accomplish your goal? (Choose all that apply.)

  1. chmod 1666 forsale

  2. chmod 4666 forsale

  3. chmod u+t forsale

  4. chmod u+s forsale

a, c. the question describes a situation in which the sticky bit comes in handy. you have a public directory and are worried about people deleting files that aren't theirs. the sticky bit is enabled with chmod 1000 in absolute mode, and with chmod u+t in symbolic mode.

2. 

You are the senior Solaris administrator for your company. One of your junior administrators was instructed by a support agent to look for a named pipe file in one of his directories. The junior administrator is confused and wants to know how to identify a named pipe. What do you tell him?

  1. Type ls -l in the directory and look for an n as the first character.

  2. Type ls -l in the directory and look for a p as the first character.

  3. Type ls -l in the directory and look for a file named pipe.

  4. Solaris does not support named pipes.

  5. Solaris does support named pipes, but they are not considered files.

b. named pipes are one of the special types of files supported in solaris. named pipe files are indicated by a p in the first character space before the file's permissions.

3. 

You are the Solaris administrator for your company. Two of your administrative reports, report1 and report2, contain similar information. You want to combine the two reports into a file named finalreport. What is the easiest way to accomplish this?

  1. cat report1 report2 >finalreport

  2. cat report1 report2 =finalreport

  3. cat finalreport >report1 report2

  4. cat finalreport

  5. touch finalreport

a. the cat command can be used to display files or, alternately, combine two or more files into a new file. the correct usage of cat to combine files is cat file1 file2 -newfile .

4. 

Consider the following directory listing:

 $ ls -l drwxrwxr-x  2 userx     finance     512 Aug 10 11:23 personal -rw-r--r--  1 userx     finance      80 Aug 10 11:44 file1 

You want to ensure that you are the only one who has access to the personal directory. Which commands could you use to accomplish this? (Choose all that apply.)

  1. chmod g= o= personal

  2. chmod go= personal

  3. chmod g-rwx,o-rx personal

  4. chmod g-rwx o-rx personal

b, c. to ensure that you are the only one with access, you must remove permissions for all other users. essentially, you want your permission structure for the directory to look something like drwx------ . you can use the = with no permissions listed to clear permissions for group and other , as in the second answer. you could also remove the assigned permissions, as in the third answer. the first and last answers do not work because they both call for multiple groups, and multiple groups need to be separated with a comma, not a space. if you were to execute these answers as listed, they would modify the group permissions but not the other permissions.

5. 

On your Solaris workstation, you need to rename a file from finreport to reportaug02. How do you accomplish this?

  1. cp reportaug02 finreport

  2. cp finreport reportaug02

  3. mv reportaug02 finreport

  4. mv finreport reportaug02

  5. ren reportaug02 finreport

  6. ren finreport reportaug02

d. to move or rename files, use the mv command. the correct syntax for renaming files is mv oldfile newfile .

6. 

You are the Solaris administrator for your company. One of your project managers recently left the company, and a replacement has been hired. You need to give ownership of the old project manager's files to the new manager. What command do you use to accomplish this?

  1. giveown

  2. chown

  3. chgrp

  4. ownfiles

b. the chown command is used to change ownership of files and directories. the giveown and ownfiles commands do not exist. the chgrp command is used to change group ownership, not individual ownership.

7. 

Consider the following directory listing:

 $ ls -l drwxrwxr-x  2 userx     finance     512 Aug 10 11:23 personal -rw-r--r--  1 userx     finance      80 Aug 10 11:44 file1 

You want to ensure that you are the only one who has access to the personal folder. Which command should you execute to accomplish this?

  1. chmod 777 personal

  2. chmod 770 personal

  3. chmod 700 personal

  4. chmod 000 personal

c. by executing chmod 700 personal , you set up permissions for the directory as drwx------ . the owner of the file will be the only one able to access it (other than the superuser, of course).

8. 

You are the Solaris administrator for your network. You have just installed a new Solaris workstation with default settings. Which directory on the computer will contain machine-local configuration files?

  1. root (/)

  2. /etc

  3. /local

  4. /opt

  5. /usr

b. the /etc directory contains machine-local configuration files. the root is the base of the directory structure. the /opt directory holds optional files, typically third-party applications. the /usr directory contains many things, including user-based commands, administrative commands, and man pages.

9. 

You are the Solaris administrator for your company. You execute the following command:

 # chmod 2744 dir1 

Which of the following effects are enacted by your command? (Choose all that apply.)

  1. The group owner of dir1 has read permissions.

  2. Mandatory locking is enabled.

  3. The SetGID bit for dir1 is enabled.

  4. The SetUID bit for dir1 is enabled.

  5. The owner of dir1 has read, write, and execute permissions.

a, b, e. the 7 in the second position gives the owner of dir1 read, write, and execute permissions, and the 4 in the third position gives the group owner read permissions to dir1 . because the third number is even, the 2000 value enables mandatory locking on the directory. if the third number were odd, then the setgid bit would, in theory, be set. however, the setgid bit cannot be set on a directory when using absolute mode. it must be set through symbolic mode.

10. 

In Solaris 9, which of the following are valid special file types, displayed with a symbol other than -? (Choose all that apply.)

  1. Boot

  2. Directory

  3. Door

  4. Hard link

  5. Named pipe

  6. Symbolic link

  7. Socket

b, c, e, f, g. the special file types, which are displayed with an alternate character, are door, directory, block, character, named pipe, symbolic link, and socket. boot files and hard links are considered regular files.

11. 

Consider the following directory listing:

 $ ls -l drwxrwxrwt  2 userx     employee     512 Aug 10 11:23 stuff -rw-r--r--  1 userx     employee      80 Aug 10 11:44 file1 

Which of the following statements are true regarding the files listed? (Choose all that apply.)

  1. The other execute bit is on for the stuff directory.

  2. The other execute bit is off for the stuff directory.

  3. Employees can delete their own files from the stuff directory.

  4. Employees can delete any files from the stuff directory.

a, c. the sticky bit is set for the stuff directory, as evidenced by the t at the end of the permissions list. because the sticky bit is set, employees can delete only files that they own. the t is lowercase, indicating that the other execute bit for the stuff directory is on.

12. 

In Solaris 9, who has the ability to change the ownership of a file? (Choose all that apply.)

  1. The owner of the file

  2. A user with write permissions to the file

  3. The superuser

  4. A member of the group that owns the file

a, c. to change the ownership of a file, you must be either the owner of the file or the superuser.

13. 

You are the Solaris administrator for your company. You are installing a new server. One of the server's responsibilities will be to host user home directories. In which directory does Sun recommend placing user home directories?

  1. /usr/export

  2. /export/home

  3. /export/usr

  4. /usr/home

b. user home directories should be placed in the /export/home directory. the other directories do not exist by default. the /usr directory holds information such as commands and man pages.

14. 

You are the Solaris administrator for your company. You are training new users on the use of hard links. Which of the following are requirements for hard links? (Choose all that apply.)

  1. Hard links must be on the same file system as the linked-to file.

  2. Hard links must be linked to a directory.

  3. There cannot be more than five hard links to any file.

  4. When creating hard links, the inode of the linked-to file must be specified.

a. hard links must be on the same file system as the file they are linking to. also, hard links must be linked to files and cannot be linked to directories. there is no limit to the number of hard links. looking at inode numbers can help determine whether a file is a hard link, but inodes are not required to create hard links.

15. 

Consider the following directory listing:

 $ ls -l drwxrwxr-x  2 userx     finance     512 Aug 10 11:23 personal -rw-r--r--  1 userx     finance      80 Aug 10 11:44 file1 -rwxr--r--  1 userx     finance     818 Aug 13 12:01 program1 

You want members of the finance group to have the same permissions as the owner has to program1. Which command could be executed to accomplish this? (Choose all that apply.)

  1. chmod g=userx program1

  2. chmod g=u program1

  3. chmod g=o program1

  4. chmod g+wx program1

  5. chmod g=wx program1

b, d. there are two ways you can accomplish your goal. one is to set permissions for the group equal to those of the owner. to do that, use chmod g=u ( group = owner ). remember, o means other, not owner, when it comes to setting permissions in symbolic mode! the second way is to modify the permissions to match those of the user. in this case, that would mean adding write and execute to the group's existing permissions, as in the fourth answer.

16. 

You are the Solaris administrator for your network. You create a new directory and you have this directory listing:

 # ls -l drwxr-xr-x  2 root     other       512 Aug 15 15:51 newdir 

What is the umask currently in use on your computer?

  1. 000

  2. 022

  3. 044

  4. 555

  5. 755

b. the default permissions for a new directory are drwxrwxrwx , which corresponds to 777 in octal code. the umask is subtracted from the default permissions. the effective permissions are 755 for the directory listed, meaning the umask is 022.

17. 

You are the Solaris administrator for your network. You have a file named file1. You want to create a hard link to file1 named access. Which command should you execute to create this link?

  1. ln file1 access

  2. ln access file1

  3. ln -s file1 access

  4. ln -s access file1

  5. ln -h file1 access

  6. ln -h access file1

a. hard links are created with the ln command. if used with no arguments, the ln command creates a hard link. the -s option creates symbolic (or soft) links. the filename is specified first, then the link name.

18. 

You are the security administrator for your company. There is a public file named phonelist. The owner of this file needs read and write permissions, as do members of the owner's group. No one else is to access the file. The only person who should be able to delete the file is the owner. What absolute mode command would you would need to execute in order to affect these security settings?

  1. chmod 666 phonelist

  2. chmod 660 phonelist

  3. chmod 600 phonelist

  4. chmod 1666 phonelist

  5. chmod 1660 phonelist

  6. chmod 1600 phonelist

e. the chmod command is used to set security permissions. because you don't want anyone except the owner deleting the file, you need to set the sticky bit, which has a value of 1000. read and write for the owner has a value of 600, and read and write for the group has a value of 60. all together, that adds up to 1660.

19. 

Consider the following directory listing:

 $ ls -i    5150 filex     9906  file3       122800 filea    5150 file2     5150  file4        53102 filel 

You execute the command rm filex. Based on the information provided, which of the following statements are true? (Choose all that apply.)

  1. filex will be deleted.

  2. file2 and file4 will be deleted.

  3. file2 and file4 will not be deleted, but they will be inaccessible.

  4. file2 and file4 will not be deleted, and they can be used to access the data that filex previously accessed.

a, d. based on their inode numbers, filex , file2 , and file3 are all hard links to the same file. it's impossible to tell which one existed first, nor does it matter. if you delete filex , which the rm filex command does, it does not affect the other links to the data. therefore, file2 and file4 still exist and can be used to access the data that filex was used to access.

20. 

You are the Solaris administrator for your company. The docs directory on your server is currently owned by the staff group. You want to give the admin group ownership of the directory. How do you accomplish this?

  1. chown admin docs

  2. chown docs admin

  3. chgrp admin docs

  4. chgrp docs admin

c. to change group ownership of a file or directory, use the chgrp command. the proper syntax for this command is chgrp newgroup file .

Answers

1. 

A, C. The question describes a situation in which the sticky bit comes in handy. You have a public directory and are worried about people deleting files that aren't theirs. The sticky bit is enabled with chmod 1000 in absolute mode, and with chmod u+t in symbolic mode.

2. 

B. Named pipes are one of the special types of files supported in Solaris. Named pipe files are indicated by a p in the first character space before the file's permissions.

3. 

A. The cat command can be used to display files or, alternately, combine two or more files into a new file. The correct usage of cat to combine files is cat file1 file2 >newfile.

4. 

B, C. To ensure that you are the only one with access, you must remove permissions for all other users. Essentially, you want your permission structure for the directory to look something like drwx------. You can use the = with no permissions listed to clear permissions for group and other, as in the second answer. You could also remove the assigned permissions, as in the third answer. The first and last answers do not work because they both call for multiple groups, and multiple groups need to be separated with a comma, not a space. If you were to execute these answers as listed, they would modify the group permissions but not the other permissions.

5. 

D. To move or rename files, use the mv command. The correct syntax for renaming files is mv oldfile newfile.

6. 

B. The chown command is used to change ownership of files and directories. The giveown and ownfiles commands do not exist. The chgrp command is used to change group ownership, not individual ownership.

7. 

C. By executing chmod 700 personal, you set up permissions for the directory as drwx------. The owner of the file will be the only one able to access it (other than the superuser, of course).

8. 

B. The /etc directory contains machine-local configuration files. The root is the base of the directory structure. The /opt directory holds optional files, typically third-party applications. The /usr directory contains many things, including user-based commands, administrative commands, and man pages.

9. 

A, B, E. The 7 in the second position gives the owner of dir1 read, write, and execute permissions, and the 4 in the third position gives the group owner read permissions to dir1. Because the third number is even, the 2000 value enables mandatory locking on the directory. If the third number were odd, then the SetGID bit would, in theory, be set. However, the SetGID bit cannot be set on a directory when using absolute mode. It must be set through symbolic mode.

10. 

B, C, E, F, G. The special file types, which are displayed with an alternate character, are door, directory, block, character, named pipe, symbolic link, and socket. Boot files and hard links are considered regular files.

11. 

A, C. The sticky bit is set for the stuff directory, as evidenced by the t at the end of the permissions list. Because the sticky bit is set, employees can delete only files that they own. The t is lowercase, indicating that the other execute bit for the stuff directory is on.

12. 

A, C. To change the ownership of a file, you must be either the owner of the file or the superuser.

13. 

B. User home directories should be placed in the /export/home directory. The other directories do not exist by default. The /usr directory holds information such as commands and man pages.

14. 

A. Hard links must be on the same file system as the file they are linking to. Also, hard links must be linked to files and cannot be linked to directories. There is no limit to the number of hard links. Looking at inode numbers can help determine whether a file is a hard link, but inodes are not required to create hard links.

15. 

B, D. There are two ways you can accomplish your goal. One is to set permissions for the group equal to those of the owner. To do that, use chmod g=u (group = owner). Remember, o means other, not owner, when it comes to setting permissions in symbolic mode! The second way is to modify the permissions to match those of the user. In this case, that would mean adding Write and Execute to the group's existing permissions, as in the fourth answer.

16. 

B. The default permissions for a new directory are drwxrwxrwx, which corresponds to 777 in octal code. The umask is subtracted from the default permissions. The effective permissions are 755 for the directory listed, meaning the umask is 022.

17. 

A. Hard links are created with the ln command. If used with no arguments, the ln command creates a hard link. The -s option creates symbolic (or soft) links. The filename is specified first, then the link name.

18. 

E. The chmod command is used to set security permissions. Because you don't want anyone except the owner deleting the file, you need to set the sticky bit, which has a value of 1000. Read and write for the owner has a value of 600, and read and write for the group has a value of 60. All together, that adds up to 1660.

19. 

A, D. Based on their inode numbers, filex, file2, and file3 are all hard links to the same file. It's impossible to tell which one existed first, nor does it matter. If you delete filex, which the rm filex command does, it does not affect the other links to the data. Therefore, file2 and file4 still exist and can be used to access the data that filex was used to access.

20. 

C. To change group ownership of a file or directory, use the chgrp command. The proper syntax for this command is chgrp newgroup file.




Solaris 9. Sun Certified System Administrator Study Guide
Solaris 9 Sun Certified System Administrator Study Guide
ISBN: 0782141811
EAN: 2147483647
Year: 2003
Pages: 194

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net