0

I belong to multiple groups (AAA, BBB, CCC, and etc.) on a Linux server. And I wrote a python code that generates a file on the server. When generated, this file belongs to group AAA, by default. But I hope the file belong to group BBB. Do I have to manually use the "chgrp" command on this file to change its group, after I run the codes? Is there a way to automatically do it so whenever I run this code, the generated file always belong to group BBB?

I've tried to "run the python codes as a member of group BBB", by switching my current group to BBB - by doing newgrp BBB and then run the codes. But it didn't work and the generated file still belong to group AAA.

Please kindly help. Thanks!

4
  • Does the parent directory happen to have the 'setgid' flag set? (i.e. rws permissions rather than the usual rwx) Commented Aug 24, 2022 at 6:20
  • Hi @user1686, thanks for your reply! I don't know the answer to your question though. Is there a command that I can use to find out? I have Googled around but no luck so far. Commented Aug 25, 2022 at 16:46
  • Run ls -ld on the directory. Commented Aug 25, 2022 at 16:47
  • Hi @user1686, I did ls -ld and saw the usual rwx, not rws. What does this imply? Thanks again and sorry for the late reponse. Commented Aug 28, 2022 at 6:22

0

You must log in to answer this question.

Browse other questions tagged .