Skip to content

cd builtin doesn't work if your group doesn't match the directory's group #1033

Closed

Description

@theclapp

The cd builtin checks whether your user ID can read a directory, or whether your actual group ID can read a directory, or whether "others" can read a directory, but it doesn't check the other groups your ID may be a member of.

% id
uid=1001(lmc) gid=1001(lmc) groups=1001(lmc),27(sudo),998(vboxsf)

% ls -ld host
drwxrwx--- 1 root vboxsf 640 Sep 16 03:48 host/

% cd host
=> error 1

It looks like you need to check user.User.GroupIds() (https://pkg.go.dev/os/user#User.GroupIds) too/instead.

Activity

  1. added 2 commits that reference this issue on Sep 27, 2023
    5d215b5
    5e89784
  2. added a commit that references this issue on Sep 30, 2023
    08cb48c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址