I can't honestly say I understand everything your code is trying to do, but
on my Linux box I just run this script..

#!/usr/bin/perl

chomp($user=shift(@ARGV));
die "No user specified at bash i.e. ./adduser.pl username\n" if $user eq "";
system("/usr/sbin/adduser $user");

Agustin Rivera
Webmaster, Pollstar.com
http://www.pollstar.com



----- Original Message -----
From: "Daniel Falkenberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 13, 2001 5:53 PM
Subject: RE: Not creating home dir....


> Hi all,
>
> I mean to do what I want I had to add the following system command is
> there and easier way to do the following code add on...?
>
> #!/usr/bin/perl -w
>
> use Unix::PasswdFile;
>
> my $new_user = "test7";
> my $new_fname = "Test";
> my $new_lname = "Account";
> my $new_pass  = "password";
>
> my $pw = new Unix::PasswdFile "/etc/passwd";
> $pw->user("$new_user", $pw->encpass("$new_pass"), $pw->maxuid + 1, 45,
> "$new_fname $new_lname", "/home/$new_user", "/bin/false");
> $pw->passwd("$new_user", $pw->encpass("$new_pass"));
> $pw->commit();
> undef $pw;
> system("pwconv $new_user");
> system("mkdir /home/$new_user");
> system("chown $new_user /home/$new_user");
> system("chgrp popusers /home/$new_user");
>
> Thx,
>
> Dan
>
> Hello all,
>
> Could some one help me with the following code?  Basically the code
> works OK except for the fact that the user $new_user (s) home dir is not
> created?
>
> #!/usr/bin/perl -w
>
> use Unix::PasswdFile;
>
> my $new_user = "test7";
> my $new_fname = "Test";
> my $new_lname = "Account";
> my $new_pass  = "password";
>
> my $pw = new Unix::PasswdFile "/etc/passwd";
> $pw->user("$new_user", $pw->encpass("$new_pass"), $pw->maxuid + 1, 45,
> "$new_fname $new_lname", "/home/$new_user", "/bin/false");
> $pw->passwd("$new_user", $pw->encpass("$new_pass"));
> $pw->commit();
> undef $pw;
> system("pwconv $new_user");
>
> Am I missing something here?
>
> Regards,
>
> Dan
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to