Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-18626

chgrp fails for file owner with read-only permissions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • Lustre 2.17.0
    • None
    • None
    • 3
    • 9223372036854775807

      Since https://review.whamcloud.com/c/fs/lustre-release/+/33996

      was merged, chgrp requests from users with read-only permissions started throwing Permission Denied errors.

      Reproducer script:

       

      # Create the groups
      sudo groupadd testGroupA
      sudo groupadd testGroupB
      # Create the user and add to groupA
      sudo useradd -m -g testGroupA testUserA
      sudo usermod -aG  testGroupB testUserA
      # Create a file owned by testUserA and testGroupA
      sudo touch /lfs/test/file.txt
      sudo chown testUserA:testGroupA /lfs/test/file.txt
      sudo chmod 444 /lfs/test/file.txt
      # Verify the ownership
      echo "Initial file ownership:"
      ls -l /lfs/test/file.txt
      # Change the group ownership to groupB using chgrp
      sudo -u testUserA chgrp testGroupB /lfs/test/file.txt
      # Verify the new ownership
      echo "Updated file ownership:"
      ls -l /lfs/test/file.txt 
      

       

      Before:

      ubuntu@ip-10-0-159-248:~$ ls -l /lfs/test/file1.txt
      -r--r--r-- 1 testUserA testGroupA 0 Dec 24 05:16 /lfs/test/file1.txt
      ubuntu@ip-10-0-159-248:~$ 
      ubuntu@ip-10-0-159-248:~$ # Change the group ownership to groupB using chgrp
      ubuntu@ip-10-0-159-248:~$ sudo -u testUserA chgrp testGroupB /lfs/test/file1.txt
      ubuntu@ip-10-0-159-248:~$ 
      ubuntu@ip-10-0-159-248:~$ # Verify the new ownership
      ubuntu@ip-10-0-159-248:~$ echo "Updated file ownership:"
      Updated file ownership:
      ubuntu@ip-10-0-159-248:~$ ls -l /lfs/test/file1.txt
      -r--r--r-- 1 testUserA testGroupB 0 Dec 24 05:16 /lfs/test/file1.txt

      After:

      Initial file ownership:
      -r--r--r-- 1 testUserA testGroupA 0 Dec 24 05:22 /lfs/test/file.txt
      chgrp: changing group of '/lfs/test/file.txt': Permission denied
      Updated file ownership:
      -r--r--r-- 1 testUserA testGroupA 0 Dec 24 05:22 /lfs/test/file.txt
      Script complete.

       

      Also confirmed XFS allows the request with Read-only permissions.

       

       

            wamax Max Wang
            wamax Max Wang
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: