7

I am following this tutorial: How To Set Up Apache Virtual Hosts on Ubuntu 14.04 LTS.

I get an error on: Step Two — Grant Permissions which states the following:

Now we have the directory structure for our files, but they are owned by our root user. If we want our regular user to be able to modify files in our web directories, we can change the ownership by doing this:

sudo chown -R $USER:$USER /var/www/example.com/public_html
sudo chown -R $USER:$USER /var/www/test.com/public_html

The $USER variable will take the value of the user you are currently logged in as when you press "ENTER". By doing this, our regular user now owns the public_html subdirectories where we will be storing our content.

We should also modify our permissions a little bit to ensure that read access is permitted to the general web directory and all of the files and folders it contains so that pages can be served correctly:

sudo chmod -R 755 /var/www

Your web server should now have the permissions it needs to serve content, and your user should be able to create content within the necessary folders.

I typed in the line in Command Line: sudo chown -R $USER:$USER /dir/ectory/ and then I get an error which says: chown: invalid group: ‘developer:developer’

I have searched and found no working solutions to this problem. I am using Ubuntu 14.04. I'm both new to Ubuntu and Stackoverflow so I apologise for any stupid mistakes that I mightn't made while asking the question. Any help is grealy appreciated!

mhcuervo
  • 2,610
  • 22
  • 33
shhasan
  • 453
  • 2
  • 9
  • 21
  • I tried your suggestion jgb and I still got the error however the username in the error message has changed. Initially it was 'chown: invalid group: ‘developer:developer’' but after trying your suggestion it changed to 'chown: invalid user: ‘paulashbourne:developer’' – shhasan Sep 04 '14 at 13:31
  • 2
    Sorry. Syntax is: `sudo chown -R $USER:$(id -gn $USER) /dir/ectory` – jgb Sep 04 '14 at 13:36
  • Thank you for the reply. I managed to fix it using `sudo chown -R username:group /dir/ect/ory` where username and group were replaced by my username and its group. – shhasan Sep 04 '14 at 14:13

1 Answers1

15

This worked:

sudo chown -R username:usergroup /var/www/nameofdirectory
shhasan
  • 453
  • 2
  • 9
  • 21