linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Adam T. Bowen" <adamb@agitate.org.uk>
To: linux-admin@vger.kernel.org
Subject: Re: Creating password for command on the fly
Date: Fri, 16 May 2008 10:12:02 +0100	[thread overview]
Message-ID: <482D4FE2.3060507@agitate.org.uk> (raw)
In-Reply-To: <91df29a20805160135l2d811216rcecf9aa1ad8eee4e@mail.gmail.com>

[-- 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 --]

  parent reply	other threads:[~2008-05-16  9:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2008-05-16  9:49 ` Carsten Aulbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=482D4FE2.3060507@agitate.org.uk \
    --to=adamb@agitate.org.uk \
    --cc=linux-admin@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).