Unix Process Questions - Quiz Explanation

The correct answers are indicated below, along with text that explains the correct answers.

1. How do UNIX processes come into being?
Please select the best answer.
  A. By carrying out infrastructure duties
  B. By responding to user commands
  C. By being cloned from an already running process
  D. By taking input from a terminal
  The correct answer is C. All processes originate from other processes. The ancestor of all processes is init.

2. How are process ownership and access permission related?
Please select the best answer.
  A. The process’s permissions are the same as those of its owner and the group to which it belongs, unless you are running the SUID bit.
  B. The owner of a running program has the same permissions as the owner of the file containing the program.
  C. The owner of the init process, root, ultimately owns every child of the init process.
  D. The shell started by su is owned by root; therefore, it owns every process on the system.
  The correct answer is A.
When a process tries to access a resource, the permissions set on that resource are compared against the process’s ownership to determine if access should be permitted. The SUID bit, however, allows users to run processes owned by root.

3. What is the purpose of the SUID bit?
Please select the best answer.
  A. It changes a user's login password.
  B. It sets a file to be owned by a more restricted user.
  C. It allows a program to run with more permissions.
  D. It runs with a different PID.
  The correct answer is C. SUID allows a program to run with more permissions than the person who started the program would be entitled to.

4. What is the purpose of the SGID bit?
Please select the best answer.
  A. It changes a user’s login password.
  B. It sets a file to be owned by a more restricted user.
  C. It allows a program to run with more permissions.
  D. It runs with a different PID.
  The correct answer is C. SGID runs in the same way as SUID, but for group ownership.

5. What is the ps command?
Please select the best answer.
  A. A command used to monitor processes on a system
  B. A command used to determine file access permissions
  C. A command used to stop daemon processes on a system
  D. A command used to determine the real user ID of a shell
  The correct answer is A. The ps command lists running processes and their status. To determine file access permissions, use the ls –l command. To stop daemon processes on a system, use the kill command with the Process ID of the daemon as its argument. To determine the real user ID of a shell, use the whoami command.

6. Where is the search path for a command set?
Please select the best answer.
  A. In /usr/ucb/bin
  B. In the system-wide login file
  C. In the system password database
  D. In /sbin
  The correct answer is B. The search path is set in the system-wide login file, usually /etc/login or /etc/profile.

7. You wish to create a periodic process using crond and crontab on a Solaris machine. You have a file named quota, which contains the following line:
15 8 * * *0 /sbin/quotacheck
You have placed this file into the
/var/spool/cron/crontabs directory. 
What is the syntax for establishing a periodic process that runs the /sbin/quotacheck program?
Please select the best answer.
  A. crond -u -root /sbin/quotacheck
  B. crontab /var/spool/cron/crontabs/quota
  C. crond /var/spool/cron/quota
  D. cron /var/spool/cron/quota
  E. crontab -u -root /var/spool/cron/crontabs/quota
  The correct answer is B. You have to use crontab, not crond, to create an entry. The syntax involves the use of crontab, followed by full path of the file that crontab will convert into a crond entry. The –u option is used in Linux to specify a username, but is not available on Solaris, AIX, or HP-UX. Also remember that the path for crontabs on Solaris is /var/spool/cron/crontabs. On Linux, the path is var/spool/cron.

8. What is the ancestor of all processes on the system?
Please select the best answer.
  A. The grep process
  B. The su process
  C. The init process
  D. The login process
  The correct answer is C. The init process is started at boot time and is given the PID of 1.