--- Delete Users from NIS - BINGNFS2 ---

Open 4 SSH shells to BINGNFS2
     3 root and 1 su -  mvsftp  . 
     All steps but #2 are run as ROOT.

1. ### out HOLD-X entries  from crontab -e

2. As MVSFTP move usernames into del.sun
        ls DELETES-TO-DO
        sh mvto-delsuns <uid-delete-file name>
   EXAMPLE: sh mvto-delsuns del.sun-ad
   
3. Make a proection copy of the tree main files
	/var/yp/src/cpPW-Shad-Adj -<date>-<file designator>
	EXAMPLE: /var/yp/src/cpPW-Shad-Adj -08-26-2020-del.sun-ad

4. Start the delete process STEP ONE DONE?
     cd /admlocal
   	  START DELETE HERE : /admlocal/bin/run_SunsAMProc.ksh del  >/var/log/SUN_del.LOG 
	MONITOR DELETE HERE : tail -f /var/log/SUN_del.LOG

6. Monitor progress
     cd /admlocal
	clear;/var/yp/src/ck4corruption.ksh             ### any of the 3 out of sync?
        cat /D2/admlocal/mvsftp/del.sun |grep -n <username> Check how far down the list.

7. If counts for any of the three files out of sync ...
        cd /var/yp/src/UTIL
        sh cleanup
        sh getANDcompem
        sh mk-pw-sed-entry.sh  ### as usually the issue is passwd.adjunct

8. Make the NIS Db and ckeck new userid counts.
	/var/yp/src/touchall 
        /admlocal/adm/makenis_check
  	cd /admlocal
        wc -l newids
        ./uid.pl
        wc -l newids

9. UN ### out jobs from crontab -e




---Restore a deleted user - BINGNFS2 ---

On Bingnfs2
/admlocal/Add-Run-Saves

egrep -w <user name>  *
You should get 3 lines... 
1. passwd
2. security/passwd.adjunct
3. shadow

Add these to the matching files in /var/yp/src
./touchall
./touchall
/admlocal/adm/makenis_check

---Clean up Users from Filesystem - BINGNFS2 ---

On Bingnfs2
cd /work/CLEAN-UP-2
The scripts to run using the dir number or letter...
00-Cleanup_files.sh

1A-Find-Users-to-Delete.bash
1-makeuserlist.sh
2-make-CkifUnknow.sh
3-FixCkifUnknow.ksh
4-GetUsers_to_check.sh
5A-MoveThese-Scripts
5-Make-Move-Script.sh



...by original more manual scheme example cleaning up /u0/users/0

./Find-Users-to-Delete.sh /u0/users/0 > userlist-0

sort +1  userlist-0  |awk '{print "echo \"ckif unknown "$2"\"; /usr/local/bin/ckall " $2}'  > CkifUnknow-0

rm top 2 lines from CkifUnknow-0
script CkifUnknow-0.out
sh CkifUnknow-0
Ctrl D
Check top lines in CkifUnknow-0

cat CkifUnknow0.out |egrep "unknown user" |wc -l; wc -l CkifUnknow-0

## what is found below must be checked individually
egrep /u0/user CkifUnknow-0.out |egrep -v ^d |cut -d: -f7 |awk '{print "ls -ld "$1}'  |sh

3 catagories returned.
1. a userid that is really in another dir
2. a userid that can be fixed with a chmod -R  
3. a userid that can't chmod'd and must be removed with the regular Delete user proces

remove users from userlist-0  and double check top lines
cat userlist-0  |awk '{print $2}' | sort -u  |awk '{print "mv /u0/users/0/"$1" /u0/NIU/0/"$1}'


---For A good account with a bad UID - BINGNFS2 ---

On Bingnfs2

cd /admlocal
Find a UID in newids, but it in UIDS_IN_USE
change to the newids UID in /var/yp/src/passwd
/var/yp/src/touchall
/admlocal/adm/makenis_check

cd to /u0/users

chown :users