home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!uwm.edu!cs.utexas.edu!rutgers!ub!exucom.com!bribbeck
- From: bribbeck@exucom.com (Bob Ribbeck)
- Newsgroups: comp.os.linux
- Subject: use a script forget adduser
- Message-ID: <1992Dec28.071828.7356@exucom.com>
- Date: 28 Dec 92 07:18:28 GMT
- Organization: ExuCom Multimedia Inc.
- Lines: 47
- X-Newsreader: TIN [version 1.1 PL8]
-
-
- Forget adduser use your own script similar to this. This one assumes
- all users to add are group 6 and get /bin/sh as their startup shell.
- it searches /etc/passwd to see if the logname is already used and counts
- the group 6 users for the next user# assuming the first user was 100.
-
-
- l'list'
- pw='/etc/passwd'
- old='/home/user1/'
-
- echo -n Enter logname:" "
- read ln
- if grep -s ^$ln $pw
- then
- echo $ln already exists
- exit
- fi
- new='/home/'$ln
- m='/usr/spool/mail/'$ln
-
- echo -n $ln:: > $l
- awk -F: '{if ($4 == "6") count++}
- END {print count+=100 >> "list" }' $pw
- echo -n Enter real name:" "
- read rn
- echo -n :6:$rn:$new:/bin/sh >> $l
- echo Jx[Bdd:wq > xx
- vi $l < xx > /dev/null
- cat $l
- echo -n If ok press enter if not press ^c
- read n
- cat $l >> $pw
- rm $l xx
-
- mkdir $new
- chown $ln $new
- chgrp users $new
- cp $old.profile $new
- cp $old.bash_history $new
- cd $new
- chown $ln .*
- chgrp users .*
- cp /dev/null $m
- chown $ln $m
- chgrp mail $m
- chmod 662 $m
-