pb with chuser ou chgroup


 
Thread Tools Search this Thread
Operating Systems AIX pb with chuser ou chgroup
# 1  
Old 07-18-2006
pb with chuser ou chgroup

hello

to use a ldap server, i must convert a parition of a P570, and so change id and gid of some users and groups.
So i have do this script :

# Change GID

Fich=/tmp/modgid.log
>$Fich
cp /etc/group /home/scripts/group.old

set -A tab C01sicso C01simca C01simcl C01simso C02sicso C02simca C02simcl CO2simso C03sicso C03simca C03simcl C03simso Dsidca Dsidcl Dsidso Dsirca Dsircl Dsirso adminsir admsidca admsidcl admsidso admsirso controlm dIPsidso dRCsidso dRPsidso invscout ldap mqm nagios snapp sshd sylsidca sylsidcl sylsidso tMusidca tMusidcl tMusidso tUmsidca tUmsidcl tUmsidso usrsas admsid admsirca admsircl adusrsid mdcsidca mdcsidcl mdcsidso mqbrkrs usrpilso usrpilca usrpilcl


i=600
a=0
while [ $i -le 653 ]
do
echo "i = $i" | tee -a $Fich
echo "tab a = $a" | tee -a $Fich
GRP=${tab[$a]}
echo "appartenance au groupe : $GRP" | tee -a $Fich
ID=`cat /etc/group | grep "${GRP}:" | awk -F":" '{print $3}'`
echo "Ancien GID : $ID" | tee -a $Fich
Verif=`cat /etc/group | grep "${GRP}:" | wc -c`
if [ $Verif -ge 10 ]
then
echo "Conversion !" | tee -a $Fich
chgroup id=$i ${GRP}
echo "Modification effectuee"
echo "Changement des fichiers concernes..."
find / -group ${ID} -exec chgrp $i {} \;
else
echo " Inexistant sur cette partition" | tee -a $Fich
fi
i=`expr $i + 1`
a=`expr $a + 1`
echo "--------------\n" | tee -a $Fich
done

# Change ID

Fich=/tmp/modid.log
>$Fich
cp /etc/passwd /home/scripts/passwd.old

set -A tab Menu auditeur ctmagent invscout k0xx01 ldap lsfadmin madminca madmincl madminso madsirca madsircl madsirso mqm nagios nuucp psipra r0xx01 s0xx01 s13084 s26301 s99999 sas9 sasguest sastrust stpadmin tina v0xx01 wadminso webadmin padminso padminca padmincl

i=600
a=0
while [ $i -le 632 ]
do
echo "i = $i" | tee -a $Fich
echo "tab a = $a" | tee -a $Fich
User=${tab[$a]}
echo "Utilisateur : $User" | tee -a $Fich
ID=`cat /etc/passwd | grep "${User}:" | awk -F":" '{print $3}'`
echo "Ancien ID : $ID" | tee -a $Fich
Verif=`cat /etc/passwd | grep "${User}:" | wc -c`
if [ $Verif -ge 10 ]
then
echo "Conversion !" | tee -a $Fich
chuser id=$i ${User}
echo "Conversion effectuee"
echo "Modification des fichiers en cours ..."
find / -user ${ID} -exec chown $i {} \;
else
echo " Inexistant sur cette partition" | tee -a $Fich
fi
i=`expr $i + 1`
a=`expr $a + 1`
echo "--------------\n" | tee -a $Fich
done



And when i have execute this script, the PRIMARY group for ALL user has been changed !!!!!!! i don't understand why ???!!!!
Thank you for your help.
# 2  
Old 07-18-2006
ok i find !
the problem is the chgroup !
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. AIX

chuser command

3001-604 Error getting user "senthild"'s attribute maxexpired. You must add this attribute with the chuser command. 3001-604 Error getting user "senthild"'s attribute histexpire. You must add this attribute with the chuser command. 3001-604 Error getting user "senthild"'s... (3 Replies)
Discussion started by: senmak
3 Replies

2. AIX

chuser with NIS???

HI, I need to be able to give a non-root user the ability to do FIFO (First In, First Out) scheduling and use high-res timers. Normally when working in a standalone environment (local user account) I can give this ability by using the chuser command. ie. chuser... (0 Replies)
Discussion started by: bblondin
0 Replies
Login or Register to Ask a Question