LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to allow user other than root to write php script? (https://www.linuxquestions.org/questions/linux-server-73/how-to-allow-user-other-than-root-to-write-php-script-759548/)

mq15 10-04-2009 03:41 AM

How to allow user other than root to write php script?
 
Hello friends,

As a root user I can write and run php scripts in /var/www/html but when I log-in as a user other than root, I am not allowed to write/update/create etc files. Please suggest some solution.

Regards.

carltm 10-04-2009 06:18 AM

The permissions on the /var/www/html directory determine who can create and
delete files in that directory. Any existing files have their own permissions.

Plan who should have write access to these files, since they will be able to
break your website or your server, whether accidentally or intentionally.

mq15 10-04-2009 11:49 AM

Thank you cery much carltm.
So how can I give the create/change/delete etc permission mq15 (the user other than root)?
[In fact I am myself the root user of my system but I log into fedora not as root user but as mq15 for security reasons. This was suggested by someone at this forum.]

mobinskariya 10-04-2009 12:12 PM

change the owner or change permissions for the directory /var/www/

mq15 10-04-2009 12:34 PM

Thanks mobinskariya but I don't know how to change permissions for /var/www/ directory...

mobinskariya 10-04-2009 12:40 PM

its simple read manual.
Code:

man chown
man chmod

if u find it urself u r goin to learn it quickly.:).if u encounter any problem come back here again and we will try to solve it.

good luck

mq15 10-04-2009 01:11 PM

Oh, that was a good way to make me learn myself...

So will
Quote:

[root@localhost ~]# chmod +x /var/www/
grant execute permissions to user? Here I am confused where to specify the user name i.e. mq15 in this command.

mobinskariya 10-04-2009 01:27 PM

Quote:

Originally Posted by mq15 (Post 3707424)
Oh, that was a good way to make me learn myself...

So will
grant execute permissions to user? Here I am confused where to specify the user name i.e. mq15 in this command.

i think u want to write some files and may b add some files in the future in /var/www/,, what you have to do change the ownership of the directory ..u must be logged in as root for performing the following
Code:

chown -R user:group /var/www/
substitute user and group with your username and groupname


then change the permissions
Code:

chmod -R u+rwx /var/www/
above code means give the read(r), write(w), and execute(x) permission to the directory owner.. -R means recursively change the permission and so permission for all the files in the subdirectories will also change..

hope that helps

mq15 10-05-2009 08:00 AM

Thanks
First: There are two users on my system:1.root and 2.mq15. So I don't know what will I have to substitute with group in this command:
Quote:

chown -R user:group /var/www/
Second:When the ownership will be changed from root to mq15, will not root be able to perform read/write operations in /var/www/ directory? I want root just to share the read/write permissions with mq15 in /var/www/ and keep the ownership with root.

mobinskariya 10-05-2009 08:24 AM

even if you dont use group it wont affect..so you may use
Code:

chown -R user /var/www/
imo root is able to do anything he wants in the system..so there wont be any problems for your root to read, write or execute anything anywhere anytime in your machine..

mq15 10-05-2009 01:08 PM

Thank you very much mobinskariya..and see I have not forgotten clicking the blue thumbs up icon..


All times are GMT -5. The time now is 04:17 PM.