Jump to content

Permissions


Guest mtf169
 Share

Recommended Posts

I've got a really dumb question. Obviously, I'm a newbie for asking this, but how do I give my self permission to write and edit files in the /var/www/html? Every file and folder outside of my users home directory is read only because the ownership belongs to root. What do I have to do to give another user permission to other directories. I'm trying to edit and create files on my server. Any help is appreciated. Thanks.

Link to comment
Share on other sites

You have several choices here. You can set the permissions for the file so that anyone can read, write, execute files in that directory. This is probably not the best choice. But to do this, simply su to root and issue this command:

 

root >chmod 777 /var/www/html

 

This will make the directory read/write/executable for anyone and everyone. However, this is definitely not the safest.

 

The next best way is to change the ownership of the directory so that you can read/write to it. This works well if you are the only person who will be putting files there. Once again, to do this su to root and type:

 

root >chown yourid /var/www/html

 

This will make you the owner of that directory.

 

The best way of doing this would be to create a group - www or web or apache - and simply add anyone who needs access to that directory a member of that group. You will also need to change the group membership for the directory. su to root and:

 

root > chgrp groupname /var/www/html

root > chmod 775 /var/www/html

 

(replace groupname with whatever you made the group)

The second line is what gives the group read/write/execute permissions for the directory.

 

Then once this is done, simply add yourself to that group. You will need to use the user and group function in the control centre (I think) in order to create the group and to add users to the group.

Link to comment
Share on other sites

Thank you so much! I was going over all the linux documentation I could find, but I wasn't finding the exact answer I needed. Even though linux is a bit daunting for a newbie, I will say that the linux community is amazing and so helpful.

 

Thanks again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...