rameeshm commented on code in PR #6:
URL: https://github.com/apache/ranger-tools/pull/6#discussion_r2655832000


##########
docker/create_users_and_groups.sh:
##########
@@ -0,0 +1,88 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Script to create users and groups in ranger containers
+# This script is designed to be run during container initialization
+
+# Function to create a group if it doesn't exist
+create_group_if_not_exists() {
+    local groupname=$1
+
+    if ! getent group "$groupname" &>/dev/null; then
+        echo "Creating group: $groupname"
+        groupadd "$groupname"
+        echo "Group $groupname created successfully"
+    else
+        echo "Group $groupname already exists"
+    fi
+}
+
+# Function to create a user for testing.
+create_user_if_not_exists() {
+    local username=$1
+    local home_dir=$2
+    local primary_group=$3
+
+    if ! id "$username" &>/dev/null; then
+        echo "Creating user: $username"
+        useradd -g "$primary_group" -m -d "$home_dir" -s /bin/bash "$username"
+
+        # Set a default password
+        echo "$username:$username" | chpasswd

Review Comment:
   this is to keep it simple in the docker environment.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to