[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Adduser Script



Rany that worked perfectly. I just need to do two more things and I am done.
Also I am pasting the script I have so far below so that others may perhaps
be able to use this. Keep in mind that when adding users this way you
will not see them show up in the web interface.

Also when you create a user using this script the contents of /etc/skel
gets copied to the user directory created. If you are using a cobalt
which I am assuming if you read this you will need I suggest
copy the contents of /etc/skel to another directory to save its contents
and then remove the contents of /etc/skel and create a web folder with
whatever page you want created automatically in the users web directory.

Only thing I need to find out now is what commandcreates the users
permission
for their directory that looks like this.
drwxrws--x

Also what is the least amount of permissions that I can set on a users
directory that will
allow the webserver to display the site when accessed?

I am currently using chmod 755 /home/sites/home/users/$user

Thanks Randy and Daniel and everyone else that has contributed to this. So
far in all the searches
I have done I have not found anything on this subject. I am hoping that by
posting others
will be able to use this as well.

Again keep in mind if you are using a cobalt server and add users this way
they WILL NOT
show up in the cobalt admin interface. And I am sure cobalt will consider
your warranty void.

Does anyone know how to recreate the userlist in the web interface that I
can add to the script
or do after users are added to get them into the web interface? Not critical
but might be nice.

I think randy had suggested running the following. Didnt seem to do
anything. I changed
the site22 to group=home

export REMOTE_USER=admin
/usr/admserv/cgi-bin/.cobalt/siteUserList/siteUserList.cgi group=site22

Change the siteXX to whatever site you are adding to.
Remember, this will take a few mins to run








!/usr/bin/perl
#These lines import the userlist from the file userpasslist
open(IN,"userpasslist");
foreach $li (<IN>)
{
  ($user,$pass) = split(/\t/,$li); # (assuming it is tab delimited)

#These lines encrypt the password that will be placed in the shadow file
srand (time ^ $$ ^ unpack ("%L*", `ps xlwwa le | gzip -f`));
@range = (qw(. /), '0'..'9','a'..'z','A'..'Z');
$x = int scalar @range;

sub randchar {
        join '', map $range[rand $x], 1..shift||1;
}

sub encrypt {
        my $salt;
        $salt = randchar(2);
        $crypted = crypt $key, $salt;
}


$key = $pass;
$cypted = encrypt;

# This line add's the user to the home group ie -g 100
`/usr/sbin/adduser $user -d /home/sites/home/users/$user -g 100 -p
$crypted`;
`/bin/chmod 755 /home/sites/home/users/$user`;
#`rest of commands you may want to add`
};
close(IN);




----- Original Message -----
From: "Randy" <rherban@xxxxxxxxxxx>
To: <cobalt-users@xxxxxxxxxxxxxxx>
Sent: Friday, December 08, 2000 5:24 AM
Subject: Re: [cobalt-users] Adduser Script


>
>
> > It seems the crypt() requires more arguments.
> >
> > I tried with your crypt('password') and it complained. I seen some
> messages
> > about adding something like crypt('password', 'CB')
>
> try this, it packs the crypt with something of which that I have no idea,
> but got the snippet of code from another of our administrators.
>
> <--snip-->
> srand (time ^ $$ ^ unpack ("%L*", `ps -xlwwa -le | gzip -f`));
> @range = (qw(. /), '0'..'9','a'..'z','A'..'Z');
> $x = int scalar @range;
>
> sub randchar {
>         join '', map $range[rand $x], 1..shift||1;
> }
>
> sub encrypt {
>         my $salt;
>         $salt = randchar(2);
>         $crypted = crypt $key, $salt;
> }
>
>
> $key = $pass;
> $cypted = encrypt;
> <--snip-->
> then when you call adduser, the -p command will need to take $crypted as
> it's input and you should be all set!
>
> _______________________________________________
> cobalt-users mailing list
> cobalt-users@xxxxxxxxxxxxxxx
> To Subscribe or Unsubscribe, please go to:
> http://list.cobalt.com/mailman/listinfo/cobalt-users
>