Re: Creating password for command on the fly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux