Super User is a question and answer site for computer enthusiasts and power users. 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 try to create file in folder with group write access, user tomcat7 is in group. Why isn't it workin?

skr@konrad~/data/asu$ sudo -u tomcat7 sh
$ whoami
tomcat7
$ echo > /home/skr/data/asu/g.gz.index
sh: 2: cannot create /home/skr/data/asu/g.gz.index: Permission denied
$ ls -la /home/skr/data/asu/
total 18708
drwxrwxr-x  2 skr skr     4096 Sep 29 08:38 .
drwxrwxr-x 85 skr skr     4096 Jul 30 00:42 ..
$ grep ^skr /etc/group
skr:x:1002:tomcat7:mail

Tried to logout, but it doesn't help. Any ideas?

share|improve this question

migrated from stackoverflow.com Sep 30 '12 at 15:09

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

Try looking at the output of id or groups. These commands show the truth of what groups the current process is actually a member of, more than grepping /etc/group does. You will probably find that the "tomcat7" user is not actually a member of the "skr" group as you intended it to be.

The reason is that you have a syntax error in /etc/group: each line of that file is supposed to contain 4 colon-delimited fields (group name, password, gid, list of members), but the line you show has 5 fields. Remove the extraneous field and delimiter (:mail) and try again.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .