Jump to content

Recommended Posts

I was wondering how one would go about running Linux commands through a php script. Like the move command with a certain chmod and chown settings. Kind of like a ftp connection started from the php script. The reason I am looking for this is because my website keeps getting hacked and destroyed because of the permissions I have to put on the folders so users can upload their files through the administration area. So I was thinking of setting up the upload script to upload the files to the server in a writable folder that is not web viewable and then in the same php script use another users credentials to move the files to the web accessible folder that has web read only access and another users write access.

 

Thank you in advance for any help you may be able to give.

 

Link to comment
https://forums.phpfreaks.com/topic/97890-use-php-for-linux-commands/
Share on other sites

PHP have all the command you have asked about, you could also use system() or exec()

 

as for the reason, i suggest you look at the design of the system, as you could fix access problems via .htaccess and http.conf and filtering user input, i have a system that allowed public users to upload anything, without any problems, this includes users attempting to upload php scripts and trying to use them..

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.