Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've set up an amazon ec2 instance and I'm have some file permission issues. I've created myself a new user and added myself to the following groups:


but when I cd /var/www I can't do simple commands without doing sudo. So I chown -R www-data:www-data /var/www to ensure that I'm in the owning group but I still have to type sudo for everything. If I sudo su www-data it works fine. Since I'm in the www-data group shouldn't I have the same privilages as www-data?

One strange thing I'm noticing is that when I ls -l it list the owner but not the group names. Could this possibly be part of the issue? Is is posible for a directory to not be part of a group?

drwxr-xr-x  4 www-data 4.0K Oct 24 16:39 .
drwxr-xr-x 14 root     4.0K Oct 10 16:58 ..
drwxrwxr-x  9 www-data 4.0K Oct 23 04:03
drwxrwxr-x  2 www-data 4.0K Oct  4 00:29
drwxrwxr-x  9 www-data 4.0K Oct 23 04:03

Edit : It appears I had some alias messing with my ls command. By calling \ls -l I can see that all my files are in the correct group.

share|improve this question
chmod -R www-data:www-data /var/www is not a valid command and would have given you an error message. chown -R www-data:www-data /var/www is probably what you meant. – Ladadadada Oct 25 '12 at 13:36
Could you add the output of alias as you to your question? It sounds like you have the -o option to ls: -o like -l, but do not list group information – Ladadadada Oct 25 '12 at 13:37
@Ladadadada Thanks for the correction. I don't think I understand your question. Are you asking if I'm using the -o flag in an alias? I don't believe so unless it's in some bash file I'm not aware of. I only have the following aliases set for ls alias ll='ls -lahG' alias ls='ls -G' – Pardoner Oct 25 '12 at 13:58
That is what I was guessing at. You could try \ls -l to avoid all aliases. – Ladadadada Oct 25 '12 at 14:05
Hey!! that worked. There must be some alias that I'm not aware of. I can't believe Amazon would put something like that on there. Still having the file permission issue though. If I do something like git pull it makes me do sudo first and then all my files are owned by root. How would I fix this? – Pardoner Oct 25 '12 at 14:09

sudo is slightly different to what you are trying to do. I recommend having a read about rootsudo and here to disable sudo. This examples the sudo command and why it is good to use it.

share|improve this answer
thanks for the suggestion. – Pardoner Oct 25 '12 at 14:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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