Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
dsmith@ip-xx-xxx-xxx-xx:~$ groups dsmith
dsmith sudo py
dsmith@ip-xx-xxx-xxx-xx:~$ sudo chmod -R g+rwxt /usr/local/virtualenvs
dsmith@ip-xx-xxx-xxx-xx:~$ ls -al /usr/local
drwxrwxr-x  2 root py   4096 2010-02-17 19:36 virtualenvs
dsmith@ip-xx-xxx-xxx-xx:~$ echo "Hello World" > /usr/local/virtualenvs/test.txt
bash: /usr/local/virtualenvs/test.txt: Permission denied
share|improve this question
up vote 1 down vote accepted

You'll need to have read (well, execute at least) on all parent directories, and write access to the file in question.

Also, groups dsmith shows what groups the dsmith user is in; while groups shows what groups the current user is in. You'll need to log in anew if they show different output.

Another thing to check is SELinux; it might be interfering.

share|improve this answer
groups returned dsmith sudo. I logged out and logged in as dsmith and it worked. A few steps back I su dsmith so I wonder if switching users instead of logging out and logging in as a different user had something to do with it. – Dave Aaron Smith Feb 17 '10 at 21:01
Another thing to be aware of is that if you add the current user to a new group, that new group won't be recognized until you logout and log back in again - or su to the same user. – Brent Feb 17 '10 at 22:36

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.