A Pluggable Authentication Module1 (PAM) is a mechanism to integrate multiple low-level authentication schemes into a high-level application programming interface (API). It allows programs that rely on authentication to be written independently of the underlying authentication scheme. PAM is based on a series of libary modules, some of which depend on the configuration file /etc/pam.conf.

Before you start working on this assignment, we recommend that you first inspect the contents of this file (if your computer makes use of this configuration file). The can be done for example with the following command

$ cat /etc/pam.conf

Assignment

The following Unix commando, which has already been partially compiled, copies the contents of a Pluggable Authentication Module to stdout.

$ cat <PAM file> |

Complete the command so that an overview of the number of authentication schemes is generated on stdout. In this overview, the authentication schemes must be listed in descending order according to the number of occurrences. If there are authentication schemes that have the same number of occurrences, they must be listed in alphabetic order.

Example

In the following command line session we assume the text file pam.conf2 to be located in the current directory.

$ cat pam.conf |  27 required
   7 requisite
   4 binding
   2 sufficient

Tips

  • Use the cut command to select specific parts of a line. Two important options are -f and -d. The first option indicates that each line must be split into fields, so that the command cut can work with these fields instead of individual characters. By default, the tab character is used as a field separator. However, the option -d can be used to specify an alternative field separator.

  • Find out what the commands tr, sort and uniq can be used for.

Submission guidelines

Only submit the part of the command that replaces the tree dots (…).