Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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.

share|improve this answer
    
How do you run PHP as multiple users though? –  Brett G Feb 20 '12 at 2:26
    
You can do that using suEXEC. –  Lèse majesté Feb 20 '12 at 2:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.