0

After trying to do a few google searches, I have been unsuccessful on finding a clear answer so I am asking on here. I am looking to how to set an Environment PATH for a group of users and not everyone on the RHEL 6 system as only that group has access to the path?

%groupname PATH=$PATH:/usr/groupshare/bin/ #this is a example of my idea but not sure how to make it work

Added Note:
You potential duplicate pointed me to a path that helped me find the details on the redhat site. Now I don't want to label the question as a duplicate as the answer isn't exactly the same but I did find an answer. Not sure how to go about it.

thebtm
  • 1,395

1 Answers1

1

Answer:

I found the answer on "How do I use custom.sh for a global user profile in rhel 6?" (requires a redhat account to access) after being pointed to it from the answer of "Is it possible to have a bashrc for a usergroup?". It says to add a new file to /etc/profile.d/ to avoid any OS upgrades modifying the /etc/profile back to defaults called <name>.sh and use the information supplied in "Is it possible to have a bashrc for a usergroup?" to created the file focused on the group.

This works for RHEL 7 as well. Have not been tested for RHEL 8.

Example file details

cd /etc/profile.d/
vim groupname.sh

file contents

Quoted from the other answer

#!/bin/sh
if [ $(id -ng) = 'the_cool_group' ]; then
     # do stuff for people in the_cool_group
fi
case ":$(id -Gn | tr [:space:] :)" in 
    *:extra_group:*) somecommand;; #tested, works # the user belongs to the group foo
esac
thebtm
  • 1,395