Account Links: Cart | Your Account | Logout

Skip to content

Red Hat Knowledgebase

Red Hat Knowledgebase Search:

Updated Within the Last:

New Solutions within the last day New Solutions within the last week New Solutions within the last month

Browse by topics:


Click to View a Topic
Red Hat Enterprise Linux > Security > Issue <<  122 of 216 >>

Solution Tools:


Email a Solution Postcard Printer version Submit a comment on this answer Update notifications Request an answer Back

Article Reference

Article ID: 8278
Last update: 04-02-07
Issue:
How do I control PAM access to 'su'?
Resolution:

The following should be noted before proceeding:

  • This should only be done on a test server. Editing of PAM files can lock out the server.
  • This is not considered a secure setup this should be used for examples only.

Set up two users: testuser1 and testuser2. Set up two groups: suroot and redgroup as follows:

#useradd testuser1
#useradd testuser2
#groupadd suroot
#groupadd redgroup

Add these two users to their respective groups:

#usermod -G suroot testuser1
#usermod -G redgroup testuser2

Backup the file /etc/pam.d/su as follows:

#cp /etc/pam.d/su /etc/pam.d/su.bak

Add the following directly under the first pam_stack.so occurrence in the /etc/pam.d/su file:

auth       required     /lib/security/$ISA/pam_stack.so service=system-auth
auth       sufficient   /lib/security/$ISA/pam_stack.so service=suroot-members
auth       sufficient   /lib/security/$ISA/pam_stack.so service=redgroup-members
auth       required     /lib/security/$ISA/pam_deny.so

Create a /etc/pam.d/suroot-members file and in the file, add the following:

auth       required     /lib/security/$ISA/pam_wheel.so use_uid group=suroot
auth       required     /lib/security/$ISA/pam_listfile.so item=user sense=allow onerr=fail file=/etc/security/sumembers-access

Create a /etc/pam.d/redgroup-members file and in the file, add the following:

auth       required     /lib/security/$ISA/pam_wheel.so use_uid group=redgroup
auth       required     /lib/security/$ISA/pam_listfile.so item=user sense=allow onerr=fail file=/etc/security/redgroup-access

Create an /etc/security/sumembers-access file. In this file, add any users, for example, testuser1, on a new line. Users added to this file will be the only users within the suroot group allowed to su to the following users:

root
backupuser
operator

Create an /etc/security/redgroup-access. Users added to this file will be the only users within the redgroup group allowed to su to the following users:

dbuser
dbbackupuser


How well did this entry answer your question?


good wrong incomplete out of date
Red Hat Enterprise Linux > Security > Issue <<   122  of  216  >>