diff options
| author | svn2git <svn2git@FreeBSD.org> | 1994-07-01 08:00:00 +0000 |
|---|---|---|
| committer | svn2git <svn2git@FreeBSD.org> | 1994-07-01 08:00:00 +0000 |
| commit | 5e0e9b99dc3fc0ecd49d929db0d57c784b66f481 (patch) | |
| tree | e779b5a6edddbb949b7990751b12d6f25304ba86 /contrib/adduser | |
| parent | a16f65c7d117419bd266c28a1901ef129a337569 (diff) | |
Diffstat (limited to 'contrib/adduser')
| -rwxr-xr-x | contrib/adduser/AddIt | 249 | ||||
| -rw-r--r-- | contrib/adduser/README | 40 | ||||
| -rw-r--r-- | contrib/adduser/dot.cshrc | 27 | ||||
| -rw-r--r-- | contrib/adduser/dot.login | 15 | ||||
| -rw-r--r-- | contrib/adduser/dot.profile | 2 | ||||
| -rw-r--r-- | contrib/adduser/userids | 1 |
6 files changed, 334 insertions, 0 deletions
diff --git a/contrib/adduser/AddIt b/contrib/adduser/AddIt new file mode 100755 index 000000000000..64f6f945013b --- /dev/null +++ b/contrib/adduser/AddIt @@ -0,0 +1,249 @@ +#!/usr/local/bin/perl + +# Copyright (c) 1994 GB Data Consulting +# All rights reserved. +# VERSION 0.8 BETA +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the Author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# 4. This license extends only to beta and network distributed versions. +# All even number versions are non-network. +# THIS SOFTWARE IS PROVIDED BY GB DATA AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL GB DATA OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# You will need to define these if you wish to have defaults or use +# that function. + +$defgroupid = 30; # Default ID +$defusrdir = "\/usr\/u"; # Default User Dir +$usequota = ""; # Use quotas +$usemail = ""; # Use mailings +$mailfile = ""; # File to use with mailings +$userdefshell = "\/bin\/csh"; # Default user shell +$useforward = ""; # Use a forward file +$protouser= ""; # Prototypical user for quotas + +# Start getting information and print a banner + +print " AddIt\n"; +print " A system utility for adding users with defaults\n"; +print " Copyright 1994 GB Data Consulting\n"; +print "\n\n"; + +# +# User ID +# + +print "Please enter the login name of the user: "; +chop ($userlogin = <STDIN>); +print "Please enter the user id or hit enter for the next id: "; +chop ($userid = <STDIN>); + +if (!$userid) { + open (USERID, "+<userids"); + chop ($xxuserid = <USERID>); + $userid = $xxuserid + 1; + close USERID; + open (USERID, "+>userids"); + print (USERID "$userid\n"); + close USERID; + } + +# +# Group ID +# + +print "Please enter the group id or hit enter for the default id: "; +chop ($groupid = <STDIN>); + +if (!$groupid) { +$groupid = "$defgroupid"; +} + +# +# User name +# + +print "Please enter the user's name: "; +chop ($username = <STDIN>); + +# +# Home directory +# + +print "Please enter the users home directory or hit enter for default: "; +chop ($userdir = <STDIN>); + +if (!$userdir) { + $userdir = "$defusrdir\/$userlogin"; + print "$userdir\n"; +} + +# +# Login Shell +# + +print "Please enter the users login shell or hit enter for default: "; +chop ($usershell = <STDIN>); + +if (!$usershell) { + $usershell = "$userdefshell"; + print "$usershell\n"; +} + +# +# Create password file entry +# + +print "Opening and locking passwd file in blocking mode.\n"; +open (PASS, '>>/etc/master.passwd'); +flock (PASS, 2) || die "Can't lock passwd file, must be in use!!\n"; +print (PASS "$userlogin::$userid:$groupid::0:0:$username,,,:$userdir:$usershell\n"); +print "Unlocking and closing password file\n"; +flock (PASS,8); +close PASS; +print "Re-indexing password databases\n"; +system 'pwd_mkdb -p /etc/master.passwd'; +system "passwd $userlogin"; + +# +# Create user directory +# +print "Creating user directory\n"; +if (! -e $defusrdir) + { + print "$defusrdir does not exist, exiting!\n"; + exit; + } +system "mkdir $userdir"; +if (! -e $userdir) + { + print "$userdir does not exist!!\n"; + print "This may be due to a parent dir not being there...\n"; + exit; + } + +print "Copying user shell files\n"; +system "cp dot.login $userdir\/\.login"; +system "cp dot.profile $userdir\/\.profile"; + +if ($usershell eq "\/bin\/csh" || $usershell eq "\/usr\/local\/bin\/tcsh") + { + system "cp dot.cshrc $userdir\/.cshrc"; + } +system "chmod -R 654 $userdir"; +system "chown -R $userid.$groupid $userdir"; + +# +# Mailings +# +if ($usemail) + { + print "Mailing new user notice\n"; + system "elm \-s \"New User Mailing\" $userid $mailfile"; + } + +# +# Quotas +# +if ($usequota) + { + print "Editing quotas for user $userlogin\n"; + if ($protouser) { + system "edquota -u -p $protouser $userlogin"; + } else { + system "edquota -u $userlogin"; + } +} + +# +# Forward files +# +if ($useforward) + { + print "Please enter the name of the account to forward to:"; + chop ($account = <STDIN>); + if (!$account) + { + $acc = $defaccount; + } + else + { + $acc = $account; + } + print "Please enter the name of the system to forward to:"; + chop ($system = <STDIN>); + if (!$system) + { + $sys = $defsystem; + } + else + { + $sys = $system; + } + print "Creating \.forward file for user $userlogin\n"; + open (FORWARD, ">$userdir\/\.forward"); + print (FORWARD "$acc@$sys\n"); + close FORWARD; + system "chown $userid\.$groupid $userdir\/\.forward"; +} + +# +# Print out information used in creation of this account +# +print "\n\n"; +print "Information used to create this account follows.\n"; +print "\n"; +print "Login Name: $userlogin\n"; +print "UserId: $userid\n"; +print "GroupId: $groupid\n"; +print "UserName: $username\n"; +print "HomeDir: $userdir\n"; +print "Shell: $usershell\n"; +if ($usemail) + { + $mailyn = "Using mailing"; + } +else + { + $mailyn = "Not using mailing"; + } +print "Mailing: $mailyn\n"; +if ($usequota) + { + $quotayn = "Using quotas"; + } +else + { + $quotayn = "Not using quotas"; + } +print "Quotas: $quotayn\n"; +if ($useforward) + { + $forwardyn = "forwarded to $acc@$sys"; + } +else + { + $forwardyn = "Not using forward file"; + } +print "ForwardFile: $forwardyn\n"; +print "\nDONE\n\n"; + + + diff --git a/contrib/adduser/README b/contrib/adduser/README new file mode 100644 index 000000000000..7ac1013e3f00 --- /dev/null +++ b/contrib/adduser/README @@ -0,0 +1,40 @@ + AddIt + Version 0.8-Beta + + +This is the README file for AddIt version 0.8Beta. AddIt is a +perl script that is intended to make adding a user to the system simple +and easy. Installation and use are very easy and directions follow. + +1. Un-tar the distribution on your system. It must have its own directory + due to other files it uses. +2. Use vi to edit the userids file if your planning on using the auto id + option of the system. Make the userid one lower than what you want + to start at. +3. Edit AddIt itself to configure the following options for use with the + system. + + A. $defgroupid: This is the default group id the system will use. + B. $defusrdir: This is the default place for the system to create + user directories and copy needed files. + C. $usequota: Define this variable if you wish to use quotas on your + system. Make sure that you have a kernel that has this defined. + D. $usemail: Define this variable if you wish to have a flyer + mailed to the user after account creation. + E. $usedefshell: Define this to be the default shell on your system. + F. $useforward: Define this variable if you wish to have .forward + files created for use on the system. + G. $protouser: Define this variable to be the proto user for use with + quotas. + H. $mailfile: This is the file to mail to a new user when $usemail is + defined. + +5. Make sure that the default user directory ($defusrdir) exists. +6. Run AddIt. The program will ask you questions about the user and + automaticly create their directory, copy startup files and then + do other things depending on how you have the system configured. + + +As normal sugestions and bug reports to bugs@radon.gbdata.com. + + diff --git a/contrib/adduser/dot.cshrc b/contrib/adduser/dot.cshrc new file mode 100644 index 000000000000..d1e8a36ee1e4 --- /dev/null +++ b/contrib/adduser/dot.cshrc @@ -0,0 +1,27 @@ +# .cshrc initialization + +alias df df -k +alias du du -k +alias f finger +alias h 'history -r | more' +alias j jobs -l +alias la ls -a +alias lf ls -FA +alias ll ls -lgsA +alias su su -m +alias tset 'set noglob histchars=""; eval `\tset -s \!*`; unset noglob histchars' +alias x exit +alias z suspend + +set path = (~/bin /bin /usr/{bin,new,games,local,old} .) + +if ($?prompt) then + # An interactive shell -- set some stuff up + set filec + set history = 1000 + set ignoreeof + set mail = (/var/mail/$USER) + set mch = `hostname -s` + set prompt = "$mch:q:$cwd:t {\!} " + umask 2 +endif diff --git a/contrib/adduser/dot.login b/contrib/adduser/dot.login new file mode 100644 index 000000000000..bdbc7506830f --- /dev/null +++ b/contrib/adduser/dot.login @@ -0,0 +1,15 @@ +#csh login file + +if ( ! $?TERMCAP ) then + tset -Q '-mdialup:?vt100' $TERM +endif + +stty newcrt crterase + +set savehist=100 +set ignoreeof + +setenv EXINIT 'set ai sm noeb' +setenv HOSTALIASES $HOME/.hostaliases + +/usr/games/fortune diff --git a/contrib/adduser/dot.profile b/contrib/adduser/dot.profile new file mode 100644 index 000000000000..95ed15cdc5ba --- /dev/null +++ b/contrib/adduser/dot.profile @@ -0,0 +1,2 @@ +PATH=/bin:/usr/bin:/usr/new:/usr/local:/usr/games:/usr/old:. +export PATH HOME TERM diff --git a/contrib/adduser/userids b/contrib/adduser/userids new file mode 100644 index 000000000000..2bc4cd64b870 --- /dev/null +++ b/contrib/adduser/userids @@ -0,0 +1 @@ +510 |
