Creating password for command on the fly

Creating password for command on the fly

am 16.05.2008 10:35:33 von gamito

Hi,

I have this command to create an FTP account:

# pure-pw useradd mario -u 502 -g 502 -n 1000 -N 200 -d /home/pages/gam=
ito

This command asks for the password twice.

I need to pass the password (preferably without expect) so I can
create the account without prompting.

If i run:

# echo secret | pure-pw useradd mario -u 502 -g 502 -n 1000 -N 200 -d
/home/pages/gamito

It reads the first insertion, but asks for the second.

I knew how to do this a long time ago, but I've forgotten and couldn't
find anything useful on Google.

Any help would be appreciated.

Warm Regards,
M=E1rio Gamito
--
To unsubscribe from this list: send the line "unsubscribe linux-admin" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Creating password for command on the fly

am 16.05.2008 10:59:22 von terry white

.. ciao:

: on "5-16-2008" "M=E1rio Gamito" writ:

: I need to pass the password (preferably without expect) so I can
: create the account without prompting.

man sleep ...


--=20
.. i'm a man, but i can change,
if i have to , i guess ...

--
To unsubscribe from this list: send the line "unsubscribe linux-admin" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Creating password for command on the fly

am 16.05.2008 11:12:02 von adamb

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig1AEF51B0EAC3672CBA8A0E0C
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

Hi,

M=E1rio Gamito wrote:
> I have this command to create an FTP account:
>=20
> # pure-pw useradd mario -u 502 -g 502 -n 1000 -N 200 -d /home/pages/gam=
ito
>=20
> This command asks for the password twice.

It's a shame it doesn't allow you to pass in a password on the command=20
line, like the UNIX useradd command, but hey ho.

I wouldn't bother using the pure-pw command, and would modify the=20
/etc/pureftpd.passwd file manually. I had a quick look at the=20
documentation and it seems you have to make sure you rebuild the passwd=20
database to commit any changes with:

pure-pw mkdb

if you manually edit it. There is a description of the passwd file=20
format in the documentation. Here is an extract:

---------------------------------------------------------
You can also edit the files by hand if you want.

Files storing virtual users have one line per user. These lines have the
following syntax:

:::::: bandwidth>:::: number of connections>::: IPs>::: IPs>:

Re: Creating password for command on the fly

am 16.05.2008 11:49:34 von Carsten Aulbert

M=E1rio Gamito wrote:
> Hi,
>=20
> I have this command to create an FTP account:
>=20
> # pure-pw useradd mario -u 502 -g 502 -n 1000 -N 200 -d /home/pages/g=
amito
>=20
> This command asks for the password twice.
>=20
> I need to pass the password (preferably without expect) so I can
> create the account without prompting.
>=20
> If i run:
>=20
> # echo secret | pure-pw useradd mario -u 502 -g 502 -n 1000 -N 200 -d
> /home/pages/gamito
>=20
> It reads the first insertion, but asks for the second.

Have you tried 'yes'?

"yes PASSWORD" will output PASSWORD as many times as possible until
STDIN is closed.


Cheers

Carsten
--
To unsubscribe from this list: send the line "unsubscribe linux-admin" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html