NEWGRP(1)

๐Ÿ’– newgrp โ€” log in to a new group ๐Ÿ’–

okay so bestie, this is newgrp(1), a User Commands girly from the shadow-utils fam. she's here to swap your group mid-session and honestly? she's lowkey iconic for it. let's get into it ๐Ÿซถ


โœจ SYNOPSIS โœจ

newgrp [-] [group]

๐ŸŒธ DESCRIPTION ๐ŸŒธ

so here's the vibe. newgrp changes your current group ID while you're still logged in. no logout, no drama, just a lil group glow-up mid-session. โœจ

now, the optional - flag? that's the main character flag fr. if you pass it, your environment gets reinitialized โ€” like you just logged in fresh, brand new, born again. if you don't pass it, everything stays exactly as it was, including your current working directory. nothing moves. nothing changes. she just changes the group and minds her business. ๐Ÿ’…

so what does she actually do?

  • she changes the current real group ID to the group you named
  • or, if you didn't name a group at all, to the default group listed in /etc/passwd
  • and she also tries to add that group to your user groupset

now for the โœจ access control moment โœจ โ€” if you're not root, you're gonna get prompted for a password in these situations:

  • you don't have a password (looked up in /etc/shadow if you have an entry in the shadowed password file, otherwise in /etc/passwd) and the group does have one
  • OR you're not listed as a member and the group has a password
๐Ÿšจ and heads up: if the group password is empty and you're not listed as a member, you get denied. that's it. no entry. the door is closed bestie ๐Ÿ˜ญ

one more thing, and this is the tea ๐Ÿ“ โ€” if there's an entry for this group in /etc/gshadow, then the list of members and the password of this group come from that file. if there isn't, then the entry in /etc/group is what we're going with. iykyk.


๐ŸŽ€ CONFIGURATION ๐ŸŽ€

these config variables in /etc/login.defs change how this tool behaves:

  • SYSLOG_SG_ENAB (boolean) โ€” enables "syslog" logging of sg activity. yes she's nosy, yes she keeps receipts ๐Ÿ’€

๐Ÿฆ‹ FILES ๐Ÿฆ‹

  • /etc/passwd โ€” user account information ๐Ÿ‘ค
  • /etc/shadow โ€” secure user account information ๐Ÿ”
  • /etc/group โ€” group account information ๐Ÿ‘ฏ
  • /etc/gshadow โ€” secure group account information ๐Ÿคซ

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

id(1), login(1), su(1), sg(1), gpasswd(1), group(5), gshadow(5). go read the whole friend group, they're all connected ๐Ÿ’œ


and that's the whole page, bestie! this one's from shadow-utils 4.19.0, dated 04/29/2026. no cap, that's the whole thing. go change a group, you absolute legend ๐Ÿ‘‘โœจ

๐Ÿ“ฆ where this page comes from