0

I am creating virtual host on Ubuntu 14 LTS. They are working fine but I cannot grant permissions to my user. I tried the command:

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

But I got the following:

chown: invalid group: 'admin:admin'

admin is my user I created to log with the ssh on my server. I am asking because as it is I cannot transfer file using filezilla (I log as admin). Any ideas?

additional info

id -g
100

groups
users sudo
Raphael_b
  • 185
  • That would mean there's no admin group. Edit your post to include the output of id -g or groups. Also, if this is a folder for a website, consider setting the group to www-data. – muru Feb 03 '15 at 13:29

1 Answers1

2

There you have it. Your primary group is not admin, but users (GID 100).

You can either:

  • leave the group empty (to use your primary group)
  • Use the id command to obtain your primary group or GID
  • or, as I suggested earlier, use www-data as the group, especially if you want the web server to be able to write to that directory. This is what I would recommend. See How to avoid using sudo when working in /var/www?

In order:

sudo chown $USER: ...
sudo chown $USER:$(id -gn) ...
sudo chown $USER:$(id -g) ...
sudo chown $USER:www-data ...
muru
  • 197,895
  • 55
  • 485
  • 740
  • thanks a lot for your answer. I am currently trying to understand what is the www-data group – Raphael_b Feb 03 '15 at 13:48
  • @Raphael_b it's the primary group of the www-data user, and Apache processes on Ubuntu usually run as www-data. See http://askubuntu.com/questions/46331/how-to-avoid-using-sudo-when-working-in-var-www/46371#46371 – muru Feb 03 '15 at 13:49
  • just a quick 'stupid' question. On your answer when you put '...' what do the dots means? – Raphael_b Feb 03 '15 at 13:49
  • @Raphael_b They're ellipses. I used those to mean whatever you'd want to put in the chmod command after that, such as other options, paths, etc. – muru Feb 03 '15 at 13:50
  • 1
    after some work I succeeded in using www-data as a group to my virtual hosts. Thanks a lot for your help! – Raphael_b Feb 03 '15 at 14:29