I have just got a issue from the user where newgrp command is not working while swicthing to the the other group from the primary group.

But when user is trying to switch it show it has been switched to the new_group which they needed and while doing id -g it showing the new_group ID as well but when user trying to create a file or directory it shows the group ownership of primary group Below is details ...

# newgrp other_group

# id -g <-- this show the goup id of the other_group which we want to use

  [ kk-uat1 ~]$ id
    uid=252498(uat1) gid=1205(kamm) groups=1198(tamm),1205(kamm)

        [ kk-uat1 ~]$ newgrp tamm
        [ kk-uat1 ~]$ id -g

        [ kk-uat1 ~]$ touch test1
        [ kk-uat1 ~]$ ls -ltrh test1
        -rw-r--r-- 1 uat1 kamm 0 Jan  1 23:20 test1

So, in the above test, even after switching to group tamm with newgrp command it creats the files with primary group ownership kamm

  • 1
    Maybe the setgid bit is set on the folder permissions? This says that all new files created in the folder are owned by the same group as the folder itself: ls -ld . would show an s instead of x at the group permissions.
    – ridgy
    Jan 2, 2018 at 10:32
  • @ridgy your point is good.
    – krock1516
    Jan 3, 2018 at 7:39


You must log in to answer this question.

Browse other questions tagged .