home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / linux / 21882 < prev    next >
Encoding:
Internet Message Format  |  1992-12-28  |  1.3 KB

  1. Path: sparky!uunet!spool.mu.edu!uwm.edu!cs.utexas.edu!rutgers!ub!exucom.com!bribbeck
  2. From: bribbeck@exucom.com (Bob Ribbeck)
  3. Newsgroups: comp.os.linux
  4. Subject: use a script forget adduser
  5. Message-ID: <1992Dec28.071828.7356@exucom.com>
  6. Date: 28 Dec 92 07:18:28 GMT
  7. Organization: ExuCom Multimedia Inc.
  8. Lines: 47
  9. X-Newsreader: TIN [version 1.1 PL8]
  10.  
  11.  
  12.   Forget adduser use your own script similar to this.  This one assumes
  13. all users to add are group 6 and get /bin/sh as their startup shell.
  14. it searches /etc/passwd to see if the logname is already used and counts
  15. the group 6 users for the next user# assuming the first user was 100.
  16.  
  17.  
  18. l'list'
  19. pw='/etc/passwd'
  20. old='/home/user1/'
  21.  
  22. echo -n Enter logname:" "
  23. read ln
  24. if grep -s ^$ln $pw
  25. then 
  26.   echo  $ln already exists 
  27.   exit
  28. fi
  29. new='/home/'$ln
  30. m='/usr/spool/mail/'$ln
  31.  
  32. echo -n $ln:: > $l
  33. awk -F: '{if ($4 == "6") count++}
  34.           END {print count+=100 >> "list" }' $pw
  35. echo -n Enter real name:" " 
  36. read rn
  37. echo -n :6:$rn:$new:/bin/sh >> $l 
  38. echo Jx[Bdd:wq > xx
  39. vi $l < xx > /dev/null 
  40. cat $l
  41. echo -n If ok press enter if not press ^c
  42. read n
  43. cat $l >> $pw
  44. rm $l xx 
  45.  
  46. mkdir $new 
  47. chown $ln $new
  48. chgrp users $new
  49. cp $old.profile $new
  50. cp $old.bash_history  $new
  51. cd $new
  52. chown $ln .*
  53. chgrp users .*      
  54. cp /dev/null $m
  55. chown $ln $m
  56. chgrp mail $m
  57. chmod 662 $m
  58.