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


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!


I suggest you to use:

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


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:

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »