SUMMARY: Change UID and Deleting Users

From: Boylan (boylan@hermes.bc.edu)
Date: Thu Feb 25 1993 - 22:36:37 CST


Here is a summary (overdue) of responses to my questions about how to change
UID's and delete users.

A. Changing UID

1) Edit the userid numbers in /etc/passwd file. If NIS is running, then
execute a ypmake passwd. Then find all the files owned by that user and
execute a chown on those files;

find . -user <old userid> -exec chown <new userid> {}\;

2) Essentially the same approach, but in a small shell script;

#!/bin/sh
#Needs to be run on every server on your network that has this userid
OLDUID= <old userid>
NEWUID=<new userid>
for DIR in `egrep 4.2 /etc/fstab | awk '{print$1}'`; do
 find $DIR -user $OLDUID -exec chown $NEWUID {}\;
done

3) Use sed

4) Use vipw.

B. Deleting Users

1) Essentially the same approach as changing UID's but delete entries from
/etc/passwd file and execute rm in find statement instead of chown.

Thanks for all the help on this, especially:

Evan L. Marcus (evan@fsg.com)
Hao Wang (hwang@sunvm1.corp.mot.com) Has shell script for delete.
Jon Brewster (jjb@cs.wayne.edu)
Chris Bulle (chris@invmms.WorldBank.Org)
Douglas L. Acker (acker@wg2.waii.com) Has some perl scripts.
Jean Chouanard (jean@hoggar.imag.fr)
Steve Elliot (se@computing.lancaster.ac.uk) Recommends good book.
Badri Pillai (Badri.Pillai@ecrc.de) Has C program.
Hal Stern (stern@sunne.East.Sun.COM)
Michael G. Harrington (mgh@bihobl2.bih.harvard.edu)
Perry Hutchison (Perry_Hutchison.Portland@xerox.com)
Mike Raffety (miker@il.us.swissbank.com)

Thanks again -

John G. Boylan
Director - NMR Facility
Boston College
Department of Chemistry

boylan@hermes.bc.edu



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:07:30 CDT