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
Easily Find Bugs In Shell Scripts With ShellCheck
Viewed 4464 times since Thu, Apr 18, 2019
FIO (Flexible I/O) – a benchmark tool for any operating system
Viewed 20775 times since Wed, Jul 25, 2018
Jak wygenerować silne hasła jednorazowe w Linuksie?
Viewed 3143 times since Thu, May 24, 2018
List usernames instead of uids with the ps command for long usernames
Viewed 3385 times since Wed, Jul 25, 2018
systemctl Use systemd to Start a Linux Service at Boot
Viewed 7078 times since Mon, Dec 7, 2020
Linux LVM recovery
Viewed 19337 times since Wed, Jan 23, 2019
LVM: Create a new Logical Volume / Filesystem
Viewed 3009 times since Sat, Jun 2, 2018
RHEL: Force system to prompt for password in Single User mode
Viewed 9210 times since Sat, Jun 2, 2018
Tips to Solve Linux & Unix Systems Hard Disk Problems
Viewed 5208 times since Fri, May 15, 2020
How to accurately determine when the system was booted
Viewed 3059 times since Wed, Oct 3, 2018