Annotation of loncom/lcuseradd, revision 1.3

1.1       harris41    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.
1.2       harris41   15: # Passwords are set with lcpasswd.
                     16: # www becomes a member of this user group.
1.1       harris41   17: 
                     18: # Standard input usage
                     19: # First line is USERNAME
                     20: # Second line is PASSWORD
1.3     ! harris41   21: # Third line is PASSWORD
1.1       harris41   22: 
1.3     ! harris41   23: # Command-line arguments [USERNAME] [PASSWORD] [PASSWORD]
1.1       harris41   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.
1.2       harris41   30: 
1.3     ! harris41   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');
1.2       harris41   40: 
                     41: # Set password with lcpasswd (which creates smbpasswd entry).
1.1       harris41   42: 

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