• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Allow only members of Wheel group to use su command on RHEL/CentOS

March 27, 2014 by Sharad Chhetri Leave a Comment

In this tutorial we will learn,how to allow only members of Wheel group to use su command.Means only members of wheel group can switch to another user by using su command.As we know that in Red Hat based operating system, wheel group is a special administrative group.

To allow only Wheel group’s member to use su command, follow the given below steps

In this method, we will edit the PAM file.

Step 1 : Add some user to wheel group by using usermod command. Select only those user which you want to allow using su command

Syntax:

usermod -a -G wheel username

For eg. We are adding user sharad in group called wheel

[root@localhost ~]# usermod -a -G wheel sharad
[root@localhost ~]# id sharad
uid=500(sharad) gid=500(sharad) groups=500(sharad),10(wheel)
[root@localhost ~]# 

Step 2: Edit the /etc/pam.d/su file. We suggest you to also take the backup of /etc/pam.d/su file in your Desktop or some other path in system.

Taking backup of /etc/pam.d/su file

cp -p /etc/pam.d/su /root/etc-pamd-su

Editing /etc/pam.d/su file

Uncomment given below line in /etc/pam.d/su

auth		required	pam_wheel.so use_uid

See below given screenshot of /etc/pam.d/su after editing
Reference: /etc/pam.d/su file edited in operating system CentOS 6.5.

su command

In below given section user called test is not able to use su command. The reason is , user test is not member of wheel group.

[test@localhost ~]$ id test
uid=501(test) gid=501(test) groups=501(test)
[test@localhost ~]$ 
[test@localhost ~]$ su
Password: 
su: incorrect password
[test@localhost ~]$ 
[test@localhost ~]$ su -l sharad
Password: 
su: incorrect password
[test@localhost ~]$ 

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Set group password,its use and check which group after newgrp command in linux
  2. Command to create and delete group in Red Hat and CentOS linux
  3. Allow wget and yum in iptable
  4. Allow root ssh login in FreeBSD 9.0
  5. group ownership reference to file/dir from other file/dir in linux
  6. semanage command not found in CentOS 6 and RHEL 6
  7. FAQ on CentOS 7 / RHEL 7 : Alternate of ifconfig command
  8. semanage command not found on CentOS 7 and RHEL 7
  9. smbpasswd command not found on CentOS 7 and RHEL 7
  10. Nagios monitoring on AWS Autoscaling group instances

Filed Under: Linux Commands, Tips And Tricks Tagged With: linux command, su command

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Linux Commands

How To Get SSH Public Key Fingerprint Information

6 important examples of cd command on Linux and Unix Systems

print working directory ( pwd , PWD , OLDPWD ) in Linux / Unix

Command to create and delete group in Red Hat and CentOS linux

How to set motd in linux

6 df Command Examples To Check Mounted Filesystem On Linux

rsync over ssh port number on Linux/Unix system

Explore 70+ Articles On Linux Commands

Always Useful Tips And Tricks

How to empty Trash through command line in Ubuntu

How to reset forgot root password in CentOS 6.x and Redhat 6.x

Nagios HTTP WARNING: HTTP/1.1 403 Forbidden

Set GRUB password after installation of CentOS/Red Hat

GNU Screen

Error installing rails

Could not find make anywhere!!! Please edit the config section to include the path to make. at ./install.pl line 2101

Explore 90+ Article On "Linux Tips And Tricks"

You Might Like These Articles!

Internal External Command

What is Linux/Unix Internal And External Command

Linux basic command

Linux Basic Commands For Every Beginner

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission but Schools and Colleges can do in their Private Network
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy