RHEL: Allowing users to ’su’ to "root" / Allowing ’root’ to login directly to the system using ’ssh’

RHEL: Allowing users to 'su' to "root" / Allowing 'root' to login directly to the system using 'ssh'

# Tested on RHEL 5, 6 & 7


# Allowing users to "su" to 'root'
# ------------------------------------------------------------------------------------------

# On a secured server regular users are not allowed to become 'root' by issuing "su" command

# /etc/pam.d/su file usually limits users that can become 'root' to those belonging to
# 'wheel' group

# This way, to allow a user to become 'root' it should be added to 'wheel' group:

usermod -g wheel <username>


# To allow all users to become super user (root), comment out following line in
# /etc/pam.d/su file (if line is uncommented only 'wheel' users will be able to do it):

   auth            required        pam_wheel.so use_uid

# To allow users in 'wheel' group to become 'root' without providing a password uncomment
# following line in /etc/pam.d/su file

   #auth           sufficient      pam_wheel.so trust use_uid


# State of these two lines can be combined in order to have one or other behaviour



# Allowing 'root' to login directly to the system via ssh
# ------------------------------------------------------------------------------------------

# Usually, after a fresh installation, 'root' is not able to login to the system via "ssh"
# To allow, verify/modify following files as necessary

# sshd_config: If existing, change "PermitRootLogin no" to "PermitRootLogin yes"

vi /etc/ssh/sshd_config
[...]
   PermitRootLogin yes
[...]

# This change requires a restart of sshd daemon:

# RHEL 5/6:service sshd restart

# RHEL 7: systemctl restart sshd



# access.conf: Change "-: root : ALL" to "+: root : ALL"

vi /etc/security/access.conf
[...]
   +: root : ALL
[...]


# Take into account that modifying this options can compromise the security of a system.
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
OEL 7 – How to disable IPv6 on Oracle Linux 7
Viewed 21343 times since Fri, Aug 3, 2018
ZFS: Remove an existing zfs filesystem
Viewed 2591 times since Sun, Jun 3, 2018
bash mistakes This page is a compilation of common mistakes made by bash users. Each example is flawed in some way.
Viewed 9629 times since Sun, Dec 6, 2020
ubuntu How to reset lost root password on Ubuntu 16.04 Xenial Xerus Linux
Viewed 8803 times since Tue, Dec 8, 2020
stunnel How To Encrypt Traffic to Redis with Stunnel on Ubuntu 16.04
Viewed 2707 times since Sun, Dec 6, 2020
Using etckeeper with git
Viewed 7464 times since Sun, Jun 3, 2018
Linux How to reset a root password on Fedora
Viewed 3124 times since Sun, Dec 6, 2020
Using Official Redhat DVD as repository
Viewed 11800 times since Mon, Oct 29, 2018
HowTo: Send Email from an SMTP Server using the Command Line
Viewed 2719 times since Mon, Feb 18, 2019
Easily Find Bugs In Shell Scripts With ShellCheck
Viewed 3841 times since Thu, Apr 18, 2019