Cannot change group of file from toolbox

I am using Fedora Silverblue 33, fully updated.

I have created a new toolbox and I have entered it.

I then do the following within the toolbox:

$ sudo groupadd group1
$ sudo usermod -a -G group1 $USER
$ echo test > /tmp/test.1
$ chown :group1 /tmp/test.1 
chown: changing group of '/tmp/test.1': Operation not permitted

Any ideas why this operation is not permitted and how I can enable it?

Because this is not your primary group.

Use sudo or make the group primary with usermod.

I tried that and it didn’t work:

Starting from a new container:

$ sudo groupadd group1
$ sudo usermod -g group1 $USER
$ id $USER
uid=1000($USER) gid=1001(group1) groups=1001(group1),10(wheel),1000($USER)
$ echo test > /tmp/test.1
$ chown :group1 /tmp/test.1
chown: changing group of '/tmp/test.1': Operation not permitted

Moreover the inital example I gave is a minimal reproducible example for a use case I have. The use case is to change the group of files from the default group to another group that more than one users are members of. I 'd like to be able to do that without having to change a user’s primary group.

The weird thing is that I have only encountered this bug(?) within a toolbox. Performing the same tasks within a podman fedora container succeeds without a problem.

Is it intentional from toolbox to do that, and if so why?

1 Like