Site icon New Generation Enterprise Linux

Stop chasing down every user session when you change their shell

User & Group Management

Stop chasing down every user session when you change their shell

🧩 The Challenge

Everyone has dealt with that one user who insists on using zsh when the company standard is bash, and changing it via usermod feels like playing whack-a-mole with their active processes. Nobody wants to hunt down every single ssh connection just to see the updated shell take effect.

💡 The Fix

Instead of forcing them to log out or hunting their PIDs, you can just change the shell variable on the fly for their current session. It saves you from being the bad guy who kills their production scripts.

chsh -s /bin/bash username
pkill -u username -f zsh

⚙️ Why It Works

Setting the shell via chsh updates the passwd entry for the next login, while a targeted pkill forces a reset for the specific shell process without blowing away their entire tmux session or background jobs.

🚀 Pro-Tip: Always double-check if the new shell is actually listed in /etc/shells or you’ll be locked out the next time you try to log in.

Linux Tips & Tricks | © ngelinux.com | 12/1/2026

0 0 votes
Article Rating
Exit mobile version