How do I crate a virtual ftp user with preseted password using ftpasswd and bash

5,820

I suggest you to use:

passwd="your_password"
echo $passwd | ftpasswd --stdin --passwd --name webftp --uid 33 --home /var/www --shell /bin/false

or

ftpasswd --stdin --passwd --name webftp --uid 33 --home /var/www --shell /bin/false < passwd.txt

where passwd.txt is a file that contain the password.

These because:

[...] the --stdin option does not allow passwords to be passed to the script on the command line, but on stdin. This is done as a security measure: the standard Unix ps command can be used to show all the processes running on a system including their command line parameters. This means that any user could use ps to watch passwords given to ftpasswd, if those passwords were to be passed on the command line.

More about:

Share:
5,820

Related videos on Youtube

Josh
Author by

Josh

I`m an Ubuntu enthusiast who likes the web in general. I think linux in general is the base for the Internet. Therefore I like to learn as lot as I can about Linux Web techniques and all related stuff that fits into my leaky brain. Currently I try to develop an automated installer for a Drupal Development Server based on Ubuntu 14 LTS and extend this basic system with basic features like ftp or even a desktop Chooser and so on. If you like o take a look go to https://horvan.github.io/drubuntu

Updated on September 18, 2022

Comments

  • Josh
    Josh over 1 year

    Hello command line gurus, I've created an ftp user like this:

    ftpasswd --passwd --name webftp --uid 33 --home /var/www --shell /bin/false
    

    What I like to do is to create the same user with a preseted password using the --stdin option. If I use:

    echo < passwd > | ftpasswd --stdin --passwd --name webftp --uid 33 --home /var/www --shell /bin/false
    

    I got a message which told me that there the password is not set.

    Does anyone see the mistake?

    Thank you!