#! /bin/bash # Execute this script to add a new user to the cluster globally echo ' ' echo 'Existing users in /etc/passwd of '$HOSTNAME cat /etc/passwd | awk -F":" '{print $1, $3}' | awk '{if($2>=1000 && $2<4000) {print}}' | sort echo ' ' /share/apps/local/bin/coc-gen_new_user if [ ! -f /share/apps/configrepo/users_data/newuser.dat ]; then echo 'The file /share/apps/configrepo/users_data/newuser.dat is not present. Not adding any new user.' else echo '/share/apps/configrepo/users_data/newuser.dat is present. To proceed with the adding of the new user to the cluster' coc-sshreachable hosts=$(cat /share/tmp/ssh-reachable.dat) for rn in $hosts do ssh $rn -oStrictHostKeyChecking=no "hostname ; sh /share/apps/local/bin/coc-adduser_local" echo ' ' done fi username=$(cat /share/apps/configrepo/users_data/newuser.dat | awk '{print $2}') passwd=$(cat /share/apps/configrepo/users_data/newuser.dat | awk '{print $4}') #echo $passwd > /home/$username/passwd.dat #chmod 500 /home/$username/passwd.dat #chown "$username": /home/$username/passwd.dat coc-pwlssh3 exportfs -r