File:  [LON-CAPA] / loncom / Attic / lcuseradd
Revision 1.3: download - view: text, annotated - select for diffs
Sun Oct 29 22:20:43 2000 UTC (23 years, 6 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
solidifying group deletion in lcuserdel, improving useradd syntax system command
for lcuseradd

    1: #!/usr/bin/perl
    2: #
    3: # lcuseradd
    4: #
    5: # Scott Harrison
    6: # October 27, 2000
    7: 
    8: use strict;
    9: 
   10: # This script is a setuid script that should
   11: # be run by user 'www'.  It creates a /home/USERNAME directory
   12: # as well as a /home/USERNAME/public_html directory.
   13: # It adds user entries to
   14: # /etc/passwd and /etc/groups.
   15: # Passwords are set with lcpasswd.
   16: # www becomes a member of this user group.
   17: 
   18: # Standard input usage
   19: # First line is USERNAME
   20: # Second line is PASSWORD
   21: # Third line is PASSWORD
   22: 
   23: # Command-line arguments [USERNAME] [PASSWORD] [PASSWORD]
   24: # Yes, but be very careful here (don't pass shell commands)
   25: # and this is only supported to allow perl-system calls.
   26: 
   27: # Security
   28: $ENV{'PATH'}=""; # Nullify path information.
   29: $ENV{'BASH_ENV'}=""; # Nullify shell environment information.
   30: 
   31: # Add user entry to /etc/passwd and /etc/groups in such
   32: # a way that www is a member of the user-specific group
   33: 
   34: # useradd [-c comment] [-d home_dir]
   35: #               [-e expire_date] [-f inactive_time]
   36: #               [-g initial_group] [-G group[,...]]
   37: #               [-m [-k skeleton_dir] | -M] [-p passwd]
   38: #               [-s shell] [-u uid [ -o]] [-n] [-r] login
   39: system('/usr/sbin/useradd','-c','LON-CAPA user','-G','www','junk');
   40: 
   41: # Set password with lcpasswd (which creates smbpasswd entry).
   42: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>