Why can't I cd into a directory that is owned by a group that I belong to?

6,479

In this case, you just added pi to the debian-transmission group. You'll need to log out and log back in again for the group membership to take effect. If you don't want to actually log out, you can do something like exec bash (assuming you use bash as your shell) instead—it should have the same effect.

id will give you active user and group information. id -G (for --groups) lists the groups for which your membership has already taken effect. If you don't see the group you need in that list, you'll need to log in again.

Share:
6,479

Related videos on Youtube

3cheesewheel
Author by

3cheesewheel

Updated on September 18, 2022

Comments

  • 3cheesewheel
    3cheesewheel over 1 year

    In the home folder of the pi user on my Raspbmc distribution, I have the following directories:

    $ sudo tree . -L 2
    .
    `-- downloads
        |-- complete
        `-- incomplete
    

    They're owned by the debian-transmission user and group, which runs transmission-daemon:

    pi@raspbmc$ ls -al
    total 44
    ...
    drwxrwx--- 4 debian-transmission debian-transmission 4096 Oct 20 18:48 downloads
    

    So are the complete and incomplete directories within:

    pi@raspbmc:~$ sudo ls -al downloads/
    total 16
    ...
    drwxrwx--- 3 debian-transmission debian-transmission 4096 Oct 20 19:35 complete
    drwxrwx--- 2 debian-transmission debian-transmission 4096 Oct 20 19:35 incomplete
    

    However, the current user, pi, is a member of the debian-transmission group:

    pi@raspbmc:~$ groups pi
    pi : pi adm disk lp dialout cdrom audio video debian-transmission
    

    So why is it that I cannot cd into downloads/?

    pi@raspbmc:~$ cd downloads/
    -bash: cd: downloads/: Permission denied
    

    I don't know much about Unix permission but it would be great if someone could help me out, since I'd like to be able to move the files from inside one of these directories to another location. I was under the impression that since all these directories have the permissions 770, any member belong to the debian-transmission should be able to go into it. Obviously I could just enter superuser mode and move the files that way, but an explanation would be great.

    • Blacklight Shining
      Blacklight Shining over 10 years
      If you only just added pi to debian-transmission, you need to log out and log back in again for the membership to take effect. I believe id -G (id --groups) displays only memberships that are already in effect.
    • 3cheesewheel
      3cheesewheel over 10 years
      Oh wow, I can't believe it was that simple. Thanks!