From 7eaffda939659b767bd0413d440f2ed6ac43418e Mon Sep 17 00:00:00 2001 From: Narine Mossikyan Date: Thu, 7 Mar 2024 01:11:19 -0800 Subject: [PATCH 1/3] fix the logic of adding omsagent user to secondary group --- installer/datafiles/linux.data | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/installer/datafiles/linux.data b/installer/datafiles/linux.data index 39cec5a14..b87d2c8f3 100644 --- a/installer/datafiles/linux.data +++ b/installer/datafiles/linux.data @@ -75,9 +75,8 @@ if [ $? -ne 0 ]; then fi # Ensure omsagent is in the omiusers group, but leave omsagent as a group -/usr/sbin/usermod -g omiusers omsagent 1> /dev/null 2> /dev/null # Ensure omsagent is in the omi group as well -/usr/sbin/usermod -g omi omsagent 1> /dev/null 2> /dev/null +/usr/sbin/usermod -g omiusers -a -G omi omsagent 1> /dev/null 2> /dev/null # Add the 'nxautomation' group if it does not already exist # (Can't use useradd with -U since that doesn't exist on older systems) From 7365aeb072bab405d4d9cf7a0bc2ba14625cfd5f Mon Sep 17 00:00:00 2001 From: Narine Mossikyan Date: Thu, 7 Mar 2024 19:59:32 -0800 Subject: [PATCH 2/3] remove omsagent user from primary group of omiusers during uninstall --- installer/datafiles/linux.data | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/installer/datafiles/linux.data b/installer/datafiles/linux.data index b87d2c8f3..9a3ac9274 100644 --- a/installer/datafiles/linux.data +++ b/installer/datafiles/linux.data @@ -74,8 +74,8 @@ if [ $? -ne 0 ]; then useradd -r -c "OMS agent" -d /var/opt/microsoft/omsagent/run -g omsagent -s /bin/bash omsagent fi -# Ensure omsagent is in the omiusers group, but leave omsagent as a group -# Ensure omsagent is in the omi group as well +# Ensure omsagent is in the omiusers primary group, but leave omsagent as a group +# Ensure omsagent is in the omi secondary group as well /usr/sbin/usermod -g omiusers -a -G omi omsagent 1> /dev/null 2> /dev/null # Add the 'nxautomation' group if it does not already exist @@ -170,6 +170,10 @@ if ${{PERFORMING_UPGRADE_NOT}}; then echo "Removing omsagent from the omi group ..." gpasswd -d omsagent omi + # Remove omsagent from the omiusers group + echo "Removing omsagent from the omiusers group ..." + gpasswd -d omsagent omiusers + # Remove the service accounts echo "Deleting nxautomation service account ..." userdel nxautomation 2> /dev/null From 776e57f5104c175dd8267ca68f2c0567d8554fd3 Mon Sep 17 00:00:00 2001 From: Narine Mossikyan Date: Fri, 8 Mar 2024 11:13:47 -0800 Subject: [PATCH 3/3] Revert "remove omsagent user from primary group of omiusers during uninstall" This reverts commit 7365aeb072bab405d4d9cf7a0bc2ba14625cfd5f. --- installer/datafiles/linux.data | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/installer/datafiles/linux.data b/installer/datafiles/linux.data index 9a3ac9274..b87d2c8f3 100644 --- a/installer/datafiles/linux.data +++ b/installer/datafiles/linux.data @@ -74,8 +74,8 @@ if [ $? -ne 0 ]; then useradd -r -c "OMS agent" -d /var/opt/microsoft/omsagent/run -g omsagent -s /bin/bash omsagent fi -# Ensure omsagent is in the omiusers primary group, but leave omsagent as a group -# Ensure omsagent is in the omi secondary group as well +# Ensure omsagent is in the omiusers group, but leave omsagent as a group +# Ensure omsagent is in the omi group as well /usr/sbin/usermod -g omiusers -a -G omi omsagent 1> /dev/null 2> /dev/null # Add the 'nxautomation' group if it does not already exist @@ -170,10 +170,6 @@ if ${{PERFORMING_UPGRADE_NOT}}; then echo "Removing omsagent from the omi group ..." gpasswd -d omsagent omi - # Remove omsagent from the omiusers group - echo "Removing omsagent from the omiusers group ..." - gpasswd -d omsagent omiusers - # Remove the service accounts echo "Deleting nxautomation service account ..." userdel nxautomation 2> /dev/null