Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

what's the best practice to do in order for me to edit the files under /var/www directory, without having to login my root password all the time? ...because I can't edit the scripts at all, undless i am at sudo -i mode

share|improve this question
up vote 4 down vote accepted

Add the user you are using to the Apache or equivalent group which owns the file. If such a group does not exist create one.

share|improve this answer
can you point me to, how to do it step by step? new to this user management thing in no system admin – sasori Nov 20 '11 at 2:10
Look up linux file ownership on Google, it should tell you how to find the information you need on your system. Then look up linux add user group and the name of your distribution. You may have a tool that will make it easier or scripts that are custom to your Linux distribution. – Bart Silverstrim Nov 20 '11 at 2:20

Here are the commands you need.

Adding a user to a user group:

sudo adduser username groupname

But, I'm not a fan of having a user with privileges other than root. I think its simple enough to just sudo commands. To edit a file, or do anything as root, without logging in simply do the following:

sudo vim /var/www/index.html

That will keep you as your user, but allow you to edit that file.

Here's a link to everything you need to know about users, and groups.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.