This page describes how the current servers access & permissions are setup.
Using the user defined bash script to create groups and users
\#\!/bin/bash \# Author: Henry Jiang \# Script: setupAccess \# Summary: set up groups and users \# Syntax: setupAccess.sh <group> <user> if \[\[ \! $# > 0 \]\] then echo "Usage: setupAccess <group> <user> " exit fi if \[\[ $# == 0 \]\] then echo "Please specify a group name" exit fi if \[\[ $# == 1 \]\] then echo "Please specify a user name" exit fi group="$1" user="$2" defaultpass="newpass" password=`openssl passwd $defaultpass` if \[\[ \! $? == 0 \]\] then echo "openssl not installed\!" exit fi \#Try to create the group, if it already exist, add user to group groupadd \-r $group if \[\[ \! $? == 0 \]\] then echo "Group $group already exists, adding user: $user to group." useradd \-g $group \-p $password \-d /home/$user \-m $user if \[\[ $? == 0 \]\] then echo "User '$user' added to group '$group' with default password '$defaultpass'" exit else echo "failed to create user" exit fi else echo "Group $group has been created, creating user: $user ..." useradd \-g $group \-p $password \-d /home/$user \-m $user if \[\[ $? == 0 \]\] then echo "User '$user' added to group '$group' with default password '$defaultpass'" exit else echo "failed to create user" exit fi fi
Add Comment