* [gentoo-dev] newuser, script for adding new users
@ 2002-02-15 20:08 Nic Desjardins
0 siblings, 0 replies; 6+ messages in thread
From: Nic Desjardins @ 2002-02-15 20:08 UTC (permalink / raw
To: gentoo-dev
I recently made a perl script for adding users in a way that almost holds your hand...
I was wondering if you guys would like to add it to the ebuilds or even default in the system install...
Nic Desjardins.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [gentoo-dev] newuser, script for adding new users
@ 2002-02-15 20:17 Sean Mitchell
2002-02-15 20:24 ` Nic Desjardins
0 siblings, 1 reply; 6+ messages in thread
From: Sean Mitchell @ 2002-02-15 20:17 UTC (permalink / raw
To: 'gentoo-dev@gentoo.org'
Nic,
I'd appreciate it if you could post it here. I've been meaning to get around
to one but just never seem to...
Sean
-----Original Message-----
From: Nic Desjardins [mailto:nic_spam@yahoo.ca]
Sent: Friday, February 15, 2002 3:09 PM
To: gentoo-dev@gentoo.org
Subject: [gentoo-dev] newuser, script for adding new users
I recently made a perl script for adding users in a way that almost holds
your hand...
I was wondering if you guys would like to add it to the ebuilds or even
default in the system install...
Nic Desjardins.
_______________________________________________
gentoo-dev mailing list
gentoo-dev@gentoo.org
http://lists.gentoo.org/mailman/listinfo/gentoo-dev
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] newuser, script for adding new users
2002-02-15 20:17 [gentoo-dev] newuser, script for adding new users Sean Mitchell
@ 2002-02-15 20:24 ` Nic Desjardins
2002-02-15 20:41 ` Nic Desjardins
0 siblings, 1 reply; 6+ messages in thread
From: Nic Desjardins @ 2002-02-15 20:24 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]
sure... i'll just attach it
On Fri, 15 Feb 2002 15:17:48 -0500
Sean Mitchell <SMitchell@phoenix-interactive.com> wrote:
> Nic,
>
> I'd appreciate it if you could post it here. I've been meaning to get around
> to one but just never seem to...
>
> Sean
>
> -----Original Message-----
> From: Nic Desjardins [mailto:nic_spam@yahoo.ca]
> Sent: Friday, February 15, 2002 3:09 PM
> To: gentoo-dev@gentoo.org
> Subject: [gentoo-dev] newuser, script for adding new users
>
>
> I recently made a perl script for adding users in a way that almost holds
> your hand...
> I was wondering if you guys would like to add it to the ebuilds or even
> default in the system install...
>
> Nic Desjardins.
> _______________________________________________
> gentoo-dev mailing list
> gentoo-dev@gentoo.org
> http://lists.gentoo.org/mailman/listinfo/gentoo-dev
> _______________________________________________
> gentoo-dev mailing list
> gentoo-dev@gentoo.org
> http://lists.gentoo.org/mailman/listinfo/gentoo-dev
[-- Attachment #2: newuser --]
[-- Type: application/octet-stream, Size: 3117 bytes --]
#!/usr/bin/perl
#################################################################
# #
# newuser-1.0.0 #
# Script entirely coded by Nic Desjardins. #
# please give credit where credit is due. #
# this script was written for the Gentoo's version of useradd. #
# #
#################################################################
if ($> != 0){
die "You don't have permission to run this application\n";
}
$username_entered = "";
$primgroup_entered = "";
$secgroup_entered = "";
$pwd_answered = "";
$smb_answered = "";
$secgroup = "no";
until ($username_entered eq "yes") {
ASKUSER:
print "User name requested: ";
$username = <STDIN>;
chomp $username;
$answer_user = getpwnam($username);
if ($answer_user eq "") {
$username_entered = "yes";
}
else {
print "Username ($username) already exists!\n";
goto ASKUSER;
}
}
until ($primgroup_entered eq "yes") {
ASKPRIMGROUP:
print "Requested primary group: ";
$primary_group = <STDIN>;
chomp $primary_group;
$answer_primgroup = getgrnam($primary_group);
if ($answer_primgroup eq "") {
print "Group ($primary_group) does not exist!\n";
goto ASKPRIMGROUP;
}
else {
$primgroup_entered = "yes";
}
}
until ($secgroup_entered eq "yes") {
ASKSECGROUP:
print "Requested secondary group(s): \n";
print "for many format like 'group1, group2...'\n";
print "Just hit ENTER for none\n";
$secondary_groups = <STDIN>;
chomp $secondary_groups;
if ($secondary_groups eq "") {
$secgroup = "no";
goto ASKPWD;
}
$secgroup = "yes";
@secondary_groups = split / /, $secondary_groups;
foreach (@secondary_groups) {
$answer_secgroup = getgrnam($_);
if ($answer_secgroup eq "") {
print "Group ($_) does not exist!\n";
goto ASKSECGROUP;
}
else {
$secgroup_entered = "yes"
}
}
}
ASKPWD:
if ($secgroup ne "yes"){
print "doing: '/usr/sbin/useradd $username -m -g $primary_group'\n";
system("/usr/sbin/useradd $username -m -g $primary_group");
}
else {
print "doing: '/usr/sbin/useradd $username -m -g $primary_group -G @secondary_groups'\n";
system("/usr/sbin/useradd $username -m -g $primary_group -G @secondary_groups");
}
until ($pwd_answered eq "yes") {
print "Would you like to enter a password? [n]/y\n";
$pwd_answer = <STDIN>;
chomp $pwd_answer;
if ($pwd_answer eq "y" | $pwd_answer eq "Y") {
system("/usr/bin/passwd $username");
$pwd_answered = "yes"
}
elsif ($pwd_answer eq "n" | $pwd_answer eq "N") {
$pwd_answered = "yes";
}
elsif ($pwd_answer eq ""){
$pwd_answered = "yes";
}
else {
goto ASKPWD;
}
}
if (-x "/usr/bin/smbpasswd") {
until ($smb_answered eq "yes") {
ASKSMB:
print "Would you like to add the user to samba? [n]/y\n";
$smb_answer = <STDIN>;
chomp $smb_answer;
if ($smb_answer eq "y" | $smb_answer eq "Y") {
print "doing: '/usr/bin/smbpasswd -a $username'\n";
system("/usr/bin/smbpasswd -a $username");
$smb_answered = "yes";
}
elsif ($smb_answer eq "n" | $smb_answer eq "N") {
$smb_answered = "yes";
}
elsif ($smb_answer eq ""){
$smb_answered = "yes";
}
else {
goto ASKSMB;
}
}
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] newuser, script for adding new users
2002-02-15 20:24 ` Nic Desjardins
@ 2002-02-15 20:41 ` Nic Desjardins
2002-02-15 22:57 ` Nic Desjardins
0 siblings, 1 reply; 6+ messages in thread
From: Nic Desjardins @ 2002-02-15 20:41 UTC (permalink / raw
To: gentoo-dev
I'd also like to mention this is not final code, I'm currently working on optimising it.
It could definaltely be run on a system in everyday use, I run it on mine.
But I'm getting it more secure and bugproof...
Nic Desjardins
On Fri, 15 Feb 2002 15:24:06 -0500
Nic Desjardins <nic_spam@yahoo.ca> wrote:
> sure... i'll just attach it
>
> On Fri, 15 Feb 2002 15:17:48 -0500
> Sean Mitchell <SMitchell@phoenix-interactive.com> wrote:
>
> > Nic,
> >
> > I'd appreciate it if you could post it here. I've been meaning to get around
> > to one but just never seem to...
> >
> > Sean
> >
> > -----Original Message-----
> > From: Nic Desjardins [mailto:nic_spam@yahoo.ca]
> > Sent: Friday, February 15, 2002 3:09 PM
> > To: gentoo-dev@gentoo.org
> > Subject: [gentoo-dev] newuser, script for adding new users
> >
> >
> > I recently made a perl script for adding users in a way that almost holds
> > your hand...
> > I was wondering if you guys would like to add it to the ebuilds or even
> > default in the system install...
> >
> > Nic Desjardins.
> > _______________________________________________
> > gentoo-dev mailing list
> > gentoo-dev@gentoo.org
> > http://lists.gentoo.org/mailman/listinfo/gentoo-dev
> > _______________________________________________
> > gentoo-dev mailing list
> > gentoo-dev@gentoo.org
> > http://lists.gentoo.org/mailman/listinfo/gentoo-dev
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] newuser, script for adding new users
2002-02-15 20:41 ` Nic Desjardins
@ 2002-02-15 22:57 ` Nic Desjardins
2002-02-16 0:20 ` Nic Desjardins
0 siblings, 1 reply; 6+ messages in thread
From: Nic Desjardins @ 2002-02-15 22:57 UTC (permalink / raw
To: gentoo-dev
NEW secure release coming out tonight... in a few hours...
Nic Desjardins
On Fri, 15 Feb 2002 15:41:31 -0500
Nic Desjardins <nic_spam@yahoo.ca> wrote:
> I'd also like to mention this is not final code, I'm currently working on optimising it.
> It could definaltely be run on a system in everyday use, I run it on mine.
> But I'm getting it more secure and bugproof...
>
> Nic Desjardins
>
> On Fri, 15 Feb 2002 15:24:06 -0500
> Nic Desjardins <nic_spam@yahoo.ca> wrote:
>
> > sure... i'll just attach it
> >
> > On Fri, 15 Feb 2002 15:17:48 -0500
> > Sean Mitchell <SMitchell@phoenix-interactive.com> wrote:
> >
> > > Nic,
> > >
> > > I'd appreciate it if you could post it here. I've been meaning to get around
> > > to one but just never seem to...
> > >
> > > Sean
> > >
> > > -----Original Message-----
> > > From: Nic Desjardins [mailto:nic_spam@yahoo.ca]
> > > Sent: Friday, February 15, 2002 3:09 PM
> > > To: gentoo-dev@gentoo.org
> > > Subject: [gentoo-dev] newuser, script for adding new users
> > >
> > >
> > > I recently made a perl script for adding users in a way that almost holds
> > > your hand...
> > > I was wondering if you guys would like to add it to the ebuilds or even
> > > default in the system install...
> > >
> > > Nic Desjardins.
> > > _______________________________________________
> > > gentoo-dev mailing list
> > > gentoo-dev@gentoo.org
> > > http://lists.gentoo.org/mailman/listinfo/gentoo-dev
> > > _______________________________________________
> > > gentoo-dev mailing list
> > > gentoo-dev@gentoo.org
> > > http://lists.gentoo.org/mailman/listinfo/gentoo-dev
> >
> _______________________________________________
> gentoo-dev mailing list
> gentoo-dev@gentoo.org
> http://lists.gentoo.org/mailman/listinfo/gentoo-dev
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-dev] newuser, script for adding new users
2002-02-15 22:57 ` Nic Desjardins
@ 2002-02-16 0:20 ` Nic Desjardins
0 siblings, 0 replies; 6+ messages in thread
From: Nic Desjardins @ 2002-02-16 0:20 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 2303 bytes --]
OK here it is, the more secure version of newuser.
Next I'll be optimising it...
If anyone has any other perl type apps they want made, I could sure to that too.
Nic Desjardins
On Fri, 15 Feb 2002 17:57:09 -0500
Nic Desjardins <nic_spam@yahoo.ca> wrote:
> NEW secure release coming out tonight... in a few hours...
>
>
> Nic Desjardins
>
>
>
> On Fri, 15 Feb 2002 15:41:31 -0500
> Nic Desjardins <nic_spam@yahoo.ca> wrote:
>
> > I'd also like to mention this is not final code, I'm currently working on optimising it.
> > It could definaltely be run on a system in everyday use, I run it on mine.
> > But I'm getting it more secure and bugproof...
> >
> > Nic Desjardins
> >
> > On Fri, 15 Feb 2002 15:24:06 -0500
> > Nic Desjardins <nic_spam@yahoo.ca> wrote:
> >
> > > sure... i'll just attach it
> > >
> > > On Fri, 15 Feb 2002 15:17:48 -0500
> > > Sean Mitchell <SMitchell@phoenix-interactive.com> wrote:
> > >
> > > > Nic,
> > > >
> > > > I'd appreciate it if you could post it here. I've been meaning to get around
> > > > to one but just never seem to...
> > > >
> > > > Sean
> > > >
> > > > -----Original Message-----
> > > > From: Nic Desjardins [mailto:nic_spam@yahoo.ca]
> > > > Sent: Friday, February 15, 2002 3:09 PM
> > > > To: gentoo-dev@gentoo.org
> > > > Subject: [gentoo-dev] newuser, script for adding new users
> > > >
> > > >
> > > > I recently made a perl script for adding users in a way that almost holds
> > > > your hand...
> > > > I was wondering if you guys would like to add it to the ebuilds or even
> > > > default in the system install...
> > > >
> > > > Nic Desjardins.
> > > > _______________________________________________
> > > > gentoo-dev mailing list
> > > > gentoo-dev@gentoo.org
> > > > http://lists.gentoo.org/mailman/listinfo/gentoo-dev
> > > > _______________________________________________
> > > > gentoo-dev mailing list
> > > > gentoo-dev@gentoo.org
> > > > http://lists.gentoo.org/mailman/listinfo/gentoo-dev
> > >
> > _______________________________________________
> > gentoo-dev mailing list
> > gentoo-dev@gentoo.org
> > http://lists.gentoo.org/mailman/listinfo/gentoo-dev
> _______________________________________________
> gentoo-dev mailing list
> gentoo-dev@gentoo.org
> http://lists.gentoo.org/mailman/listinfo/gentoo-dev
[-- Attachment #2: newuser --]
[-- Type: application/octet-stream, Size: 3420 bytes --]
#!/usr/bin/perl -T
#################################################################
# #
# newuser-1.1.0 #
# Script entirely coded by Nic Desjardins. #
# please give credit where credit is due. #
# this script was written for the Gentoo's version of useradd. #
# #
#################################################################
# #
# Changelog: #
# program now runs in Tainted mode, making it more secure. #
# #
#################################################################
if ($> != 0){
die "You don't have permission to run this application\n";
}
sub BEGIN {
$ENV{'PATH'} = '/bin:/usr/bin:/usr/sbin';
delete @ENV{ 'IFS', 'CDPATH', 'ENV', 'BASH_ENV' };
}
$username_entered = "";
$primgroup_entered = "";
$secgroup_entered = "";
$pwd_answered = "";
$smb_answered = "";
$secgroup = "no";
until ($username_entered eq "yes") {
ASKUSER:
print "User name requested: ";
$username = <STDIN>;
chomp $username;
$answer_user = getpwnam($username);
if ($answer_user eq "") {
$username_entered = "yes";
}
else {
print "Username ($username) already exists!\n";
goto ASKUSER;
}
}
until ($primgroup_entered eq "yes") {
ASKPRIMGROUP:
print "Requested primary group: ";
$primary_group = <STDIN>;
chomp $primary_group;
$answer_primgroup = getgrnam($primary_group);
if ($answer_primgroup eq "") {
print "Group ($primary_group) does not exist!\n";
goto ASKPRIMGROUP;
}
else {
$primgroup_entered = "yes";
}
}
until ($secgroup_entered eq "yes") {
ASKSECGROUP:
print "Requested secondary group(s): \n";
print "for many format like 'group1, group2...'\n";
print "Just hit ENTER for none\n";
$secondary_groups = <STDIN>;
chomp $secondary_groups;
if ($secondary_groups eq "") {
$secgroup = "no";
goto ASKPWD;
}
$secgroup = "yes";
@secondary_groups = split / /, $secondary_groups;
foreach (@secondary_groups) {
$answer_secgroup = getgrnam($_);
if ($answer_secgroup eq "") {
print "Group ($_) does not exist!\n";
goto ASKSECGROUP;
}
else {
$secgroup_entered = "yes"
}
}
}
ASKPWD:
if ($secgroup ne "yes"){
print "doing: '/usr/sbin/useradd $username -m -g $primary_group'\n";
system "/usr/sbin/useradd", $username, '-m', '-g', $primary_group;
}
else {
print "doing: '/usr/sbin/useradd $username -m -g $primary_group -G @secondary_groups'\n";
system "/usr/sbin/useradd", $username, '-m', '-g', $primary_group, '-G', @secondary_groups;
}
until ($pwd_answered eq "yes") {
print "Would you like to enter a password? [n]/y\n";
$pwd_answer = <STDIN>;
chomp $pwd_answer;
if ($pwd_answer eq "y" | $pwd_answer eq "Y") {
system "/usr/bin/passwd", $username;
$pwd_answered = "yes"
}
elsif ($pwd_answer eq "n" | $pwd_answer eq "N") {
$pwd_answered = "yes";
}
elsif ($pwd_answer eq ""){
$pwd_answered = "yes";
}
else {
goto ASKPWD;
}
}
if (-x "/usr/bin/smbpasswd") {
until ($smb_answered eq "yes") {
ASKSMB:
print "Would you like to add the user to samba? [n]/y\n";
$smb_answer = <STDIN>;
chomp $smb_answer;
if ($smb_answer eq "y" | $smb_answer eq "Y") {
print "doing: '/usr/bin/smbpasswd -a $username'\n";
system "/usr/bin/smbpasswd", '-a', $username;
$smb_answered = "yes";
}
elsif ($smb_answer eq "n" | $smb_answer eq "N") {
$smb_answered = "yes";
}
elsif ($smb_answer eq ""){
$smb_answered = "yes";
}
else {
goto ASKSMB;
}
}
}
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-02-16 0:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-15 20:17 [gentoo-dev] newuser, script for adding new users Sean Mitchell
2002-02-15 20:24 ` Nic Desjardins
2002-02-15 20:41 ` Nic Desjardins
2002-02-15 22:57 ` Nic Desjardins
2002-02-16 0:20 ` Nic Desjardins
-- strict thread matches above, loose matches on Subject: below --
2002-02-15 20:08 Nic Desjardins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox