Day 10 – Linux User, Group & Session Management

🎯 On Day 10, I explored how Linux handles users, groups, permissions, and sessions—skills every DevOps engineer must master.

🧑‍💻 Commands I Practiced

👤 User Info & Session Checks

  • View current user:

      whoami
    

Display all users & groups:

 cat /etc/passwd
 cat /etc/group

Find info about a specific user:

grep vagrant /etc/passwd
grep vagrant /etc/group
id <user>

➕ Add Users && Groups:

  • Add user
 useradd <name>
  • Add a group:
groupadd <name>

Add user to group:

 usermod -aG <group name> <user name>

🔐 Passwords & Login Set user passwords:

passwd <username>

Switched to a user:

 su - <user name>

🔍 Session & File Usage

Checked login history:

 last 
  who
  • Installed and used lsof to see open files:
yum install lsof -y 
lsof -u vagrant

🧹 Deletion & Cleanup

  • Deleted users (with home directories):
 userdel -r <user name>

Deleted group:

 groupdel <group name>

Verified home directory cleanup:

ls /home/

💡 Key Learnings

  • ✅ Add users and groups securely

  • ✅ Assign users to secondary groups

  • ✅ Manage login credentials and switch users

  • ✅ Monitor active sessions

  • ✅ Clean up users and groups cleanly

📌 Next Steps

I’ll now dive into Linux File Permissions & Ownership

0
Subscribe to my newsletter

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

Written by

Shaharyar Shakir
Shaharyar Shakir