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

link|improve this question

33% accept rate
feedback

2 Answers

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.

link|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
feedback

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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