开发者

Creating an FTP Account with PHP (and/or Shell Scripts)

Im running a small project where I woul开发者_如何学编程d like to have an FTP account made using a php execution. Either it be PHP itself or a shell script that gets called on, I googled and still found no cigar, so as a last hope I came here to ask if its possible, and if so If you can link me to a answer or provide your own on how to do it. Thanks.


<?php

shell_exec('useradd -G ftp ' . $username);

Where $username is the user and ftp is the group name. This assumes your ftp program has the group 'ftp' set up. Also, this may create a user's home directory in /home/$username so that will be the default FTP directory in most cases.

This also assumes that PHP is running as the root/privileged user to be able to run shell_exec(), which if you're on shared hosting is usually not available.

Note: This is also not available in safe mode.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜