Newly created file/directory with wrong group id

When I create a new file or directory under my working directory /project/scec_608, the group id is my user id, instead of the correct group owner id scec_608, and won’t let me write new files (vim error E512).

Even though I manually changed group id using chgrp command after creating files/directories, I still encounter error in writing files (vim error E667).

Please advise how to fix this issue. Thanks very much!

@xiaofenm Sounds like the default permissions are not set for some reason. Try a set of commands like the following:

chgrp -R ttrojan_123 /project/ttrojan_123
find /project/ttrojan_123 -type d -exec chmod g+s {} \;

Make sure to substitute the correct group ID and project directory or subdirectory path.

I have the same issue, which prevents me from creating files touch x or running git commands in the project/jonmay_231 directory. I can fix it by running newgrp jonmay_231 but it is tedious to do this every time and would like it to be the default setting whenever I’m doing operations within this directory. I think this was how things worked for me but when I recently used the endeavour cluster, this is causing an issue for me.

Hi,

Most likely the issue is that the setgid bit is not enabled for the directory in which you are creating new files. You can try running chmod g+s directory_name to enable it. If that doesn’t work, can you let me know which directory you’re in? If you’re not comfortable sharing it publicly, you can email me or create a ticket.

-Cesar

Thank you. I think it’s working now, but I still feel uneasy since the error did sometimes occur in random moments even when I had the newgrp run, so I’d appreciate it if you can take a look and see if you can confirm whether there isn’t an issue. It’s /project/jonmay_231/hjcho.

Hi,

There are some directories that do not have the setgid bit enabled. You can check with this command:

find /project/jonmay_231/hjcho -type d -not -perm /2000

If you want you can add chmod g+s to your find command to search and chmod these directories like so:

find /project/jonmay_231/hjcho -type d -not -perm /2000 -exec chmod g+s {}\;

-Cesar

1 Like

Great, thank you! This seems to have worked.