I have a VPS with WHM/CPanel which is being used just by me. It's utilizing proftpd. I'd like to, via a PHP script, disable/enable a specific FTP account. I've done this by having PHP call a bash script which removes/adds the user account line to /etc/proftpd/USERNAME password file. However, in order to do this I have to give other write rights to /etc/proftpd/USERNAME. This isn't ideal, and I'd be willing to do it another way. It also seems like WHM is automatically resetting these permissions on a regular basis. Does anybody have any ideas on a better way to deal with this?
That's how file permissions work. If you want a user/group to have access to a file, then they need the permission to do it. If you don't want your PHP/Apache user to have access to that file, then you can't use PHP to do the enabling/disabling.
You could, however, create a separate user to run PHP as for this admin panel. This way the PHP admin panel is able to enable/disable FTP accounts, but your other PHP users won't have access to the file. One way to do this is through suEXEC.