Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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?..am new to this user management thing in linux..am no system admin –  sasori Nov 20 '11 at 2:10
1  
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.

https://help.ubuntu.com/8.04/serverguide/C/user-management.html

share|improve this answer

Your Answer

 
discard

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.