27.5. Enabling Console Access for Other Applications
To make other applications accessible to console users, a bit more work is required.
First of all, console access only works for applications which reside in
/usr/sbin/, so the application that you wish to run must be there. After verifying that, do the following steps:
- Create a link from the name of your application, such as our sample
fooprogram, to the
ln -sconsolehelper foo
- Create the file
- Create a PAM configuration file for the
/etc/pam.d/. An easy way to do this is to start with a copy of the halt service's PAM configuration file, and then modify the file if you want to change the behavior:
cp /etc/pam.d/halt /etc/pam.d/foo
consolehelperis called, which authenticates the user with the help of
/usr/sbin/userhelper. To authenticate the user,
consolehelperasks for the user's password if
/etc/pam.d/foois a copy of
/etc/pam.d/halt(otherwise, it does precisely what is specified in
/etc/pam.d/foo) and then runs
/usr/sbin/foowith root permissions.
In the PAM configuration file, an application can be configured to use the pam_timestamp module to remember (or cache) a successful authentication attempt. When an application is started and proper authentication is provided (the root password), a timestamp file is created. By default, a successful authentication is cached for five minutes. During this time, any other application that is configured to use
pam_timestampand run from the same session is automatically authenticated for the user — the user does not have to enter the root password again.
This module is included in the
pampackage. To enable this feature, the PAM configuration file in
etc/pam.d/must include the following lines:
auth sufficient /lib/security/pam_timestamp.so session optional /lib/security/pam_timestamp.so
The first line that begins with
authshould be after any other
auth sufficientlines, and the line that begins with
sessionshould be after any other
If an application configured to use
pam_timestampis successfully authenticated from the Main Menu Button (on the Panel), the icon is displayed in the notification area of the panel if you are running the GNOME or KDE desktop environment. After the authentication expires (the default is five minutes), the icon disappears.
The user can select to forget the cached authentication by clicking on the icon and selecting the option to forget authentication.