🚀 day 11 – Fixing Ghost Group ID Issue in Linux (DevOps Practice)

Ritesh SinghRitesh Singh
2 min read

Today I encountered and resolved a real-world Linux user/group issue — a ghost group ID left over after deleting a group (docker) that my user was still a member of.


⚠️ The Problem

After running:

sudo groupdel docker

Then checking:

groups

I saw:

groups: cannot find name for group ID 137
137 devs

This meant the group with GID 137 was deleted, but my session still referenced it.


🔍 Investigation

Step 1: Checked active groups

id ritesh

Step 2: Validated /etc/group

getent group | grep 137   # No result
getent group docker       # docker:x:1011:ritesh

Confirmed that group 137 no longer existed.


✅ The Fix

Step 1: Reassign valid groups

sudo usermod -G sudo,docker ritesh

Step 2: Log out and log back in

This cleared the ghost group from the session.

Step 3: Recheck

groups
# Output:
ritesh sudo docker

Step 4: Verified with:

id ritesh
# Output:
uid=1000(ritesh) gid=1000(ritesh) groups=1000(ritesh),27(sudo),1011(docker)

🧠 Key Takeaways

  • Linux can retain ghost group IDs in active sessions after groupdel

  • Use id and getent group to debug group memberships and GIDs

  • usermod -G helps reset valid group memberships

  • Always logout/login to refresh session and group context


📌 Useful Commands

CommandDescription
id usernameShow UID, GID, and all groups
groupsShow all groups for current user
getent groupList valid groups from system DB
sudo usermod -G group1,group2 userReassign group membership
sudo groupdel groupnameDelete a system group
logoutRefresh your shell session


🧠 Quote of the Day

"Understanding groups and permissions is not just a Linux skill — it's a DevOps superpower."

0
Subscribe to my newsletter

Read articles from Ritesh Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ritesh Singh
Ritesh Singh

Hi, I’m Ritesh 👋 I’m on a mission to become a DevOps Engineer — and I’m learning in public every single day.With a full-time commitment of 8–10 hours daily, I’m building skills in: ✅ Linux✅ Git & GitHub✅ Docker & Kubernetes✅ AWS EC2, S3✅ Jenkins, GitHub Actions✅ Terraform, Prometheus, Grafana I post daily blogs on Hashnode, push projects to GitHub, and stay active on LinkedIn and Twitter/X. Let’s connect, collaborate, and grow together 🚀 #100DaysOfDevOps #LearningInPublic #DevOps