El 16/05/2008, a las 10:38, Mário Gamito escribió:

I have this command to create an FTP account:

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

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.

Dear Mario,

I have the same problem some days ago, try with this:

( echo ${PASSWORD} ; echo ${PASSWORD} ) | pure-pw useradd ${USUARIO} - u ftpuser -g ftpgroup -d /backup/${USUARIO} -N ${QUOTA} -m > /dev/ null 2>&1

From the FAQ at:

http://pureftpd.sourceforge.net/FAQ

"* Passwords and pure-pw scripting."

====================================================================
-> I would like to create virtual users with a shell-script.  if i us
pure-pw useradd ..... it always asks for the new password. is there any
command-line option which tells pure-pw the password (like useradd ftp-user
ftp-password -m) ? (at1ce) .

Giving cleartext (and badly one-way hashed) passwords through command- line switches is a bad idea. Because users could issue a simple 'ps' command and
discover these passwords.

One way to enter a password (not from the keyboard) is to put the password
twice in a temporary file, then redirect that file to stdin. Example:

pure-pw useradd john -d /tmp/john -u ftpuser -m < ~/tmp/passfile

And in ~/tmp/passfile, have something like:

john's password
john's password

If you really need to avoid a temporary file and if nobody but you can log
on the machine, you can always do this:

(echo blahblah; echo blahblah) | pure-pw useradd john -d /tmp/john -u ftpuser
====================================================================

Regards,

--
Santi Saez
Hostalia Internet S.L.U.
http://www.hostalia.com

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Reply via email to