Linux to execute script-generated file owner as root solution through command line

Source: Internet
Author: User

Executing the script from the command line, the owner of the generated and exported file is root, which adds an obstacle to the two processing of webserver.

(1) through Su www can solve this problem

However, in the case of the/sbin/nologin specified by the security www user's shell, this means that this cannot be toggled through SU.

(2) To specify permissions by modifying the umask of profile files, equivalent to chmod

This method is not only troublesome, but also unsafe

(3) activating via Curl

This is also a way to add in the code:

The code is as follows Copy Code

<?php Ignore_user_abort (true);?>

(4) through Crontab-u www-e

This method is more reliable, with the prevention of repeated execution of the script

  code is as follows copy code

<?php
if (intval (shell_exec ps-ef|grep. basename (__file__)) |wc-l)
exit (' repeat process ');//Prevent duplicate running
?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.