ie type /bin/passwd user password
instead of having to run /bin/passwd interactively? I`m attempting to write
a CSH script to create accounts and set default passwords.
No comment on your choice of language, but I'd be tempted to do it
in C and use the system calls. From memory, try "man putpwent."
--
Bill Davidsen (davi...@tmr.com)
"The secret to procrastination is to put things off until the
last possible moment - but no longer" -me
Write a script in expect.
I'd use expect. Have a look at http://www.cme.nist.gov/pub/expect/
Andrew Moar : email A.M...@latrobe.edu.au : ph. (03) 479 3928
Systems Programmer, Information Technology
La Trobe University, Melbourne
Hmm... I'm almost finished with a newusr command in C. My idea was to check
for evertyihg, including nfs mounted home directories, soft links to
home directory roots, and suggest home directories for users in certain
groups by checking to see where most members of a group currently reside.
After all, I won't be here forever, and after I leave, unix haters will have
to administer UNIX computers they know nothing about.
Anyways, if you are interested, I suspect I will have some functional code
finished by next week sometime.
BTW, who was talking about putpwent? Is that POSIX? I noticed that I have
it, but don't know if it can be used to create a new entry.
Ken.
--
/--\--/--\--/--\--/--\--/--\--/--\--/--\--/--\--/--\--/--\--/--\--/--\--/--\
\ The Whittaker's domain! /
/ Try our MUD (Multi User Domain) \
\ Come to: /
/ aGe oF iNsaNitY \
\ telnet to: newton.whit.org 4000 /
/--\--/--\--/--\--/--\--/--\--/--\--/--\--/--\--/--\--/--\--/--\--/--\--/--\
% crypt_passwd testone2
ppHOs/VqtIKd.
-------
#!/usr/local/bin/perl
{
@salt = ('a','b','c','d','e','f','g','h','i','j','k','l','m',
'n','o','p','q','r','s','t','u','v','w','x','y','z',
'A','B','C','D','E','F','G','H','I','J','K','L','M',
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'0','1','2','3','4','5','6','7','8','9');
$salt_cnt = 62;
if($#ARGV != 0) {
print "usage: crypt_passwd passwd\n";
exit;
}
$input = $ARGV[0];
srand(time|$$);
$salt1 = int(rand($salt_cnt)) + 1;
$salt1 = @salt[$salt1];
$salt2 = int(rand($salt_cnt)) + 1;
$salt2 = @salt[$salt2];
$salt1 = "$salt1$salt2";
$encrypted = crypt($input,$salt1);
print "$encrypted\n";
}
-------------
Easyest meathod would be to write a C or Perl application and use the crypt(3)
and getpwent(3)/putpwent(3) functions.
Andrew Moar (a.m...@latrobe.edu.au) wrote:
: Davis Steven Alston <s...@asiaonline.net> wrote:
: | Is there a way to automatically set passwords for accounts?
: |
: | ie type /bin/passwd user password
: |
: | instead of having to run /bin/passwd interactively? I`m attempting to write
: | a CSH script to create accounts and set default passwords.
: I'd use expect. Have a look at http://www.cme.nist.gov/pub/expect/
: Andrew Moar : email A.M...@latrobe.edu.au : ph. (03) 479 3928
: Systems Programmer, Information Technology
: La Trobe University, Melbourne
--
Chris Riney E-mail: cri...@tandy.com
Technical Services PostM...@tandy.com
Tandy Information Services Phone: (817) 878-0308