30.3. Disabling All Console Access

The PAM pam_console.so module manages console file permissions and authentication. (Refer to the Red Hat Enterprise Linux Reference Guide for more information on configuring PAM.) To disable all console access, including program and file access, comment out all lines that refer to pam_console.so in the /etc/pam.d/ directory. As root, the following script does the trick:

cd /etc/pam.d
for i in * ; do
sed '/[^#].*pam_console.so/s/^/#/' < $i > foo && mv foo $i
done