Jump to content


- - - - -

How to add files to /var/www


  • Please log in to reply
2 replies to this topic

#1 wildweaselmi

wildweaselmi

    Administrator

  • Administrators
  • 1,024 posts

Posted 05 January 2012 - 08:03 AM

If you make /var/www writeable by its group and add the user to the group, that user will not have to use sudo. Try this:

sudo usermod -a -G www-data [username]

sudo chown -R root:www-data /var/www

sudo chmod -R g+rw /var/www


The user should then be able to edit /var/www/ files without hassle.
The first line adds the user to the www-data group, the second line clears up any files with messed up ownership, and the third makes it so that all users who are members of the www-data group can read and write all files in /var/www.

#2 rev.research

rev.research

    Member

  • Members
  • PipPipPip
  • 65 posts

Posted 18 April 2012 - 07:50 AM

I'm having issues when updating my site with new files and its obvious its a permissions issue.  When I try and run the above command I get the following error message.

Quote

username is not in the sudoers file.  This incident will be reported.

Any idea's?

#3 wildweaselmi

wildweaselmi

    Administrator

  • Administrators
  • 1,024 posts

Posted 18 April 2012 - 07:59 AM

You need to ask the administrators of that machine to add you, or to install the package for you, as per the policies of the site.
You should also be sure to use visudo to edit the sudoers file - it checks that the syntax is correct before writing the file. And you can use editors other than vi with visudo. It will by default use whatever you have set as $EDITOR and if you don't have it set you could do
# EDITOR=nano visudo
to use the nano editor instead.

If you have access to root, then login as root and then edit the sudoers file.
Just type su and press enter and enter the password for root
Then open up the sudoers file: nano /etc/sudoers

You can uncomment the following and just add your user to the wheel group
## Allows people in group wheel to run all commands
%wheel  ALL=(ALL)    ALL


Or you can just add the user(s) that you want to work like root by adding them under this line
## Allow root to run any commands anywhere
root    ALL=(ALL)    ALL






Similar Topics Collapse

  Topic Forum Started By Stats Last Post Info

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users