linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Creating password for command on the fly
@ 2008-05-16  8:35 Mário Gamito
  2008-05-16  8:59 ` terry white
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mário Gamito @ 2008-05-16  8:35 UTC (permalink / raw)
  To: linux-admin

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/gamito

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ário 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Creating password for command on the fly
  2008-05-16  8:35 Creating password for command on the fly Mário Gamito
@ 2008-05-16  8:59 ` terry white
  2008-05-16  9:12 ` Adam T. Bowen
  2008-05-16  9:49 ` Carsten Aulbert
  2 siblings, 0 replies; 4+ messages in thread
From: terry white @ 2008-05-16  8:59 UTC (permalink / raw)
  To: linux-admin

... ciao:

: on "5-16-2008" "Mário Gamito" writ:

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

   man sleep ...


-- 
... 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Creating password for command on the fly
  2008-05-16  8:35 Creating password for command on the fly Mário Gamito
  2008-05-16  8:59 ` terry white
@ 2008-05-16  9:12 ` Adam T. Bowen
  2008-05-16  9:49 ` Carsten Aulbert
  2 siblings, 0 replies; 4+ messages in thread
From: Adam T. Bowen @ 2008-05-16  9:12 UTC (permalink / raw)
  To: linux-admin

[-- Attachment #1: Type: text/plain, Size: 1673 bytes --]

Hi,

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

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

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

pure-pw mkdb

if you manually edit it.  There is a description of the passwd file 
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:

<account>:<password>:<uid>:<gid>:<gecos>:<home directory>:<upload
bandwidth>:<download bandwidth>:<upload ratio>:<download ratio>:<max 
number of connections>:<files quota>:<size quota>:<authorized local 
IPs>:<refused local IPs>:<authorized client IPs>:<refused client 
IPs>:<time restrictions>

Fields can be left empty (exceptions: account, password, uid, gid, home
directory) .
---------------------------------------------------------

Alternatively, you may be able to do something like:

echo "password\npassword" | pure-pw useradd ...

but I don't run or have the pure ftp stuff installed, so I can't promise 
that that will work.  Depends on how the command reads input from stdin.

Hope that helps

Cheers

Adam


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Creating password for command on the fly
  2008-05-16  8:35 Creating password for command on the fly Mário Gamito
  2008-05-16  8:59 ` terry white
  2008-05-16  9:12 ` Adam T. Bowen
@ 2008-05-16  9:49 ` Carsten Aulbert
  2 siblings, 0 replies; 4+ messages in thread
From: Carsten Aulbert @ 2008-05-16  9:49 UTC (permalink / raw)
  To: Mário Gamito; +Cc: linux-admin



Mário Gamito wrote:
> 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/gamito
> 
> 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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-05-16  9:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-16  8:35 Creating password for command on the fly Mário Gamito
2008-05-16  8:59 ` terry white
2008-05-16  9:12 ` Adam T. Bowen
2008-05-16  9:49 ` Carsten Aulbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).