Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Dec 2001 01:48:51 -0800
From:      "Crist J . Clark" <cjc@FreeBSD.ORG>
To:        ScaryG <freymann@scaryg.shacknet.nu>
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: adduser in a perl script question
Message-ID:  <20011229014851.H93411@blossom.cjclark.org>
In-Reply-To: <20011228101438.187f0eb0.freymann@scaryg.shacknet.nu>; from freymann@scaryg.shacknet.nu on Fri, Dec 28, 2001 at 10:14:38AM -0500
References:  <20011228101438.187f0eb0.freymann@scaryg.shacknet.nu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Dec 28, 2001 at 10:14:38AM -0500, ScaryG wrote:
> Hi Gang.
> 
> I'm trying to automate the creation of a new user in a perl5 script.
> 
> The following does not work:
> 
> $error = `/usr/sbin/adduser -shell $shell -fullname $name -password
> $password -username $username -home /home/$name`;

Nope. There are a lot of options used there that don't exist.

> This runs as root and the variables are populated in advance.
> 
> I've read the man(8) page for adduser but it's not helping.

adduser(8) is intended for interactive use, not in scripts...

> I need to set
> the password which is why I'm not using pw.

pw(8) is the tool to use for scripts.

> The man pages for pw talk
> about a pipe for the password but there are no examples.
> 
> I'm hoping somebody else out there can toss me a pointer or two to make
> this work?

As someone else pointed out,

  # echo "$password" | pw add user "$username" -h 0

Is a trivial example.
-- 
"It's always funny until someone gets hurt. Then it's hilarious."

Crist J. Clark                     |     cjclark@alum.mit.edu
                                   |     cjclark@jhu.edu
http://people.freebsd.org/~cjc/    |     cjc@freebsd.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011229014851.H93411>