php - Command line script to create user passwd -


I am very new to Linux and PHP so please forgive me if this is a dumb question.

I need to create a PHP command line script which will add the user to the system, which will be used by the FTP server. I have installed it at this point that this account creates just fine. The problem I am experiencing is that even if I pass an account by creating an account I -p $ password, I still have to run the "passwd" command on the account and manually set the password before it That proftpd will log into that account.

For my life, I can not understand how to run the passwd command within php, obviously I can run it, but I do not know how to ask the program to enter the password. / P>

For more information, I run it when I create an account that passes in the $$ username and $ password function.

  shell_exec ("useradd" .username. "-g ftpusers -m -p". $ Password. "-d / home / ftp  

Now looking for something to add to the lines of:

  shell_exec (/ "passwd" $ Username); $ password; echo $ password;  
< P> For the record, this last example is just for illustration.

Any help appreciated.

You must use the useradd password using the head password, e.g.,

  $ Password = escapeshellarg (crypt ('password')) shell_exec ("useradd username -p $ password ");  

-p, --password PASSW ORD encrypted password, as given by crypto (3), is to disable default account.

()


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -