Can't change user and group of the file via the php chown() and exec("chown ..."), the error is not permited, how to fix?

Hello. The problem is that when using chown() error Not Permited. Via the command exec("chown...") or system("chown ...") generally do not issue, but when checking vozvraschaetsya the result is false. How to solve this problem for 3 days over her bathing?
Server virtual machine on Ubuntu.
July 9th 19 at 10:17
2 answers
July 9th 19 at 10:19
You have exactly dostanochno privileges to chown?
If displays this error it is likely not enough privileges. File using php sozdaetsya user a group admin. I added the admin user to sudo, and root didn't help( - Halle.VonRued commented on July 9th 19 at 10:22
Well, run the script as root. What prevents. - giuseppe25 commented on July 9th 19 at 10:25
how? - Halle.VonRued commented on July 9th 19 at 10:28
July 9th 19 at 10:21
Privilege to change the owner has a root. You need to run chown on its behalf through the mechanism of su or sudo.
exec sudo returns false, and also shell_exec( - Halle.VonRued commented on July 9th 19 at 10:24
: and also su - giuseppe25 commented on July 9th 19 at 10:27
: because you have not configured sudo without requiring a password, see man sudo - Halle.VonRued commented on July 9th 19 at 10:30

Find more questions by tags PHPLinux