Who owns the tar tar tar exp file?

Regarding file permissions, when you use a php script to unzip a tar file, who is the user of the file owner?

I am wondering if my ftp user is mine because I downloaded the script file? Or does apache own the file? I know their flags are set to keep the original permissions which I don't want (files created and archived by someone else). I want my user to be the creator / owner of the files.

PS Its a cloudy environment. Below is the code I downloaded. I accomplished by visiting the page in a browser. I can change the permissions on files in Dreamweaver ... Does that mean I'm the owner?

exec('wget http://wordpress.org/latest.tar.gz');

exec('tar -xzvf latest.tar.gz');

+2


source to share


3 answers


Most likely, if run from apache, the user who is running apache is like.



+5


source


No matter which user is running PHP. Its either the system username of the web server or the owner of the webroot (via suexec). If it belongs to the server, its probability is nobody

or www-data

.



Most importantly, custom PHP (server side) is running. Try this to find out.

+3


source


You can do echo shell_exec('whoami');

And this will output the username. For me, he deducedapache

And yes, apache will own the files. For example, if you do something like this as root:

root@localhost# cp /home/user/foo /home/user/foo2
root@localhost# ls -l /home/user
-rw-rw-r--  1 user user       232 Apr  12 12:00 foo
-rw-rw-r--  1 root root       232 Apr  12 12:01 foo2

      

+1


source







All Articles