Well today I wanted to make a script to automatically create some user for an account from shell, that’s because they where to many to make them manually from cpanel/whm . Also this command work on your server even if you have pure-ftpd or proftpd ) , because the cpanel keep the virtual user information into /etc/proftpd/
So , how to add a ftp user from shell ?
Well the syntax is :
/usr/local/cpanel/bin/proftpd_passwd
So first of all we have to know the uid and gid for this we can grep the passwd file.
grep
Example how to add a username for matrafox system user :
grep matrafox /etc/passwd
matrafox:x:xxx:yyy::/home/matrafox:/usr/local/cpanel/bin/noshell
/usr/local/cpanel/bin/proftpd_passwd matrafox -a testuser:testpassword:xxx:yyy:matrafox:/home/matrafox/public_html:/sbin/nologin
If you want to detele a user the syntax is:
/usr/local/cpanel/bin/proftpd_passwd
Also if you manually edit a file you should run also the command so changes to take effect :
/usr/local/cpanel/bin/ftpupdate