2

Possible Duplicate:
What is the best way to add files to a website on a LAMP Server?

I have installed lamp on Ubuntu 12.04.

I try to access /var/www but it doesn't allow me to do anything as it says I don't have permissions.

I have tried:

1.
gksudo nautilus - which works but its very inconvenient way of doing things.

2.
sudo adduser ryan www-data
sudo chown -R www-data:www-data /var/www
sudo chmod g+rw /var/www

The above didn't work.

I have googled and searched this site for a solution, but all the existing possible solutions have not worked.

2
  • Hi Ryan, is this a production environment or not?
    – weberc2
    May 14, 2012 at 21:26
  • No just at home
    – RSM
    May 14, 2012 at 21:33

2 Answers 2

3

You need to use usermod.

usermod will modify your user.

You can then modify your user to be part of the www-data group.

$ sudo usermod -a -G www-data your-user

http://www.computerhope.com/unix/usermod.htm

3
  • I tried that and it said: cannot lock /etc/passwd; try again later.
    – RSM
    May 15, 2012 at 13:13
  • I had to do it on SU
    – RSM
    May 15, 2012 at 15:59
  • I have updated it to mention sudo.
    – dibs
    May 22, 2012 at 21:00
0

This is probably not the most secure or recommended solution, but sudo chmod 764 should give you what you need, assuming your user is an owner or group member. If not, 766 should work but that means any user on your system can write to that directory. Not secure, but if you need a quick fix it ought to work.

Not the answer you're looking for? Browse other questions tagged .