[SOLVED] How to allow user other than root to write php script?
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.]
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
Last edited by mobinskariya; 10-04-2009 at 01:30 PM.
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.
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..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.