Hello all,
I know it is Administrators' nightmare to give admin rights to
Users....but here we are dealing with adults and we attend to give admin
rights to people, if there is a business justification for it.
One of the engineers sent this command to a Mac (I believe via ARD).
dscl . -append /Groups/admin GroupMembership username
...and now all accounts turn in to standard including hidden admin account
and Casper ssh account (these accounts are in /private/var). Also account
in /Users/username still a standard account too (that was the dscl command
meant to target).
Any ideas why did this happened? Or anyone has seen this before?
We are using Casper v7.31 and client Mac has MacOS X 10.6.5
This concerns me because, I am planning to use this script (see first
script below) through Casper Remote and it uses the same command (see the
last line of the first script)
I have tweaked one of the Casper Resources Kit script, so Service Desk can
use it with ease by just selecting the Mac then the script and adding the
User's name in variable 1. This way they can give and take admin rights
on/off. (I have also added the reverse script at the bottom - script 2)
Even though I have tested this scripts dozens of times with success, I am
not sure this command/s will break the admin group 80 ??? Perhaps I should
be looking at alternative!?
I just don't want to break things, so your input is welcome.
Cheers
Cem
1st script: to give admin rights to specific user (use with Casper
Remote.app)
#!/bin/sh
# ABOUT THIS PROGRAM
#
# NAME
# GiveAdminRightsToUser.sh -- Add User to Administrative Group.
#
# SYNOPSIS
# sudo GiveAdminRightsToUser.sh
# sudo GiveAdminRightsToUser.sh <mountPoint> <computerName>
<currentUsername> <AdminUser>
#
# If the $AdminUser parameter is specified (parameter 4), this is the User
# that will be assigned administrative privileges on the target machine.
#
# Example values: AdminUser=""AdminUser1"
#
# If no parameter is specified for parameter 4, the hardcoded value in
the script will be used.
#
# DESCRIPTION
# This script will add the User that will have administrative access on
the machine.
# This script should be run after a machine has been bound to Active
Directory.
# Run it "at reboot" if you are using with Casper Imaging.
#
# The <timeout> value can be used with a hardcoded value in the script, or
read in as a parameter.
# Since the Casper Suite defines the first three parameters as (1) Mount
Point, (2) Computer
# Name and (3) username, we are using the fourth parameter ($4) as the
passable parameter.
#
###########################################################################
#########################
#
# HISTORY
#
# Version: 1
#
# - Created by Cem Baykara on January 31st, 2011 (tweaked Casper Resources
Kit script)
#
#
###########################################################################
#########################
#
# DEFINE VARIABLES & READ IN PARAMETERS
#
###########################################################################
#########################
# HARDCODED VALUE FOR "AdminUser" IS SET HERE
AdminUser=""
# CHECK TO SEE IF A VALUE WAS PASSED IN PARAMETER 4 AND, IF SO, ASSIGN TO
"AdminUser"
if [ "$4" != "" ] && [ "$AdminUser" == "" ]; then
AdminUser=$4
fi
###########################################################################
#########################
#
# SCRIPT CONTENTS - DO NOT MODIFY BELOW THIS LINE
#
###########################################################################
#########################
if [ "$AdminUser" == "" ]; then
echo "Error: No AdminUser is specified."
exit 1
fi
echo "Giving User the admin priviliges..."
fi
echo "Giving User the admin priviliges..."
dscl . -append /Groups/admin GroupMembership "$AdminUser"
