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
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; whilegroups
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.