[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] Adduser Script
- Subject: Re: [cobalt-users] Adduser Script
- From: "Jim Scott" <cobaltlist@xxxxxxxxxxxx>
- Date: Thu Dec 7 14:26:01 2000
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
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')
I tried this and it did encrypt and complete in the script I tried. I looked
in the /etc/shadow file
and the password is in fact encrypted. However I am unable to log in with
the account
not matter what I do.
If I go and issue a passwd username at the command prompt and change the
password
the account can log in.
Anyone familiar with crypt that perhaps could give me some guidance?
Here is what my script looks like so far.
#!/usr/bin/perl
open(IN,"userpasslist");
foreach $li (<IN>)
{
($user,$pass) = split(/\t/,$li); # (assuming it is tab delimited)
$cpass = crypt('$pass', 'CB');
`/usr/sbin/adduser $user -d /home/sites/home/users/$user -g 100 -p $cpass`;
#`rest of commands,etc`
};
close(IN);
Thanks again for everyone's help. I am just about there.
Jim
----- Original Message -----
From: "Daniel Foster" <daniel@xxxxxxxx>
To: <cobalt-users@xxxxxxxxxxxxxxx>
Sent: Thursday, December 07, 2000 3:27 AM
Subject: Re: [cobalt-users] Adduser Script
> The problem is going to be getting them entered into the /etc/shadow
file
> with
> the encrypted password. So far the way to do this as I know is to go
to a
> command
> line and enter
>
> passwd username
>
> Then it prompts you to enter new password
> then prompts you to re-type password.
>
> How would one automate that process within this script you sent
> me so that it could take the password and enter these commands
> automatically?
You can specify the password on the adduser line. It says exactly how
in the man page, but I think its with the -p switch. The parameter
you give it has to be the encrypted from of the password, as generated
by crypt(). I'm no shell scripting guy, but a bit of Perl to do this
might be:
$cpass = crypt('password');
`adduser username -g 100 -c "User Fullname" -d
/home/sites/home/users/username -p $cpass`;
--
"With $10,000, we'd be millionaires!"
Homer Simpson
Daniel Foster - daniel@xxxxxxxx
_______________________________________________
cobalt-users mailing list
cobalt-users@xxxxxxxxxxxxxxx
To Subscribe or Unsubscribe, please go to:
http://list.cobalt.com/mailman/listinfo/cobalt-users