Quickly discover which login shells a user has and whether those shells impose restrictions. 16.11.2025 | reading time: 3 min You will learn how to find which shell a user uses and whether that shell prevents normal actions; this is practical work at the command line to spot rbash, nologin or other restrictions and to take corrective action. Quick discovery Find a user's shell with a single query and inspect the raw passwd entry; for example run the command and see the result in one step: ```bash getent passwd alice alice:x:1001:1001::/home/alice:/bin/rbash ``` Scan for restricted accounts Search the passwd database for well-known noninteractive or restricted shells to get a fast list of affected users, for example: ```bash grep -E ':(/sbin/nologin|/bin/false|/bin/rbash|/usr/bin/rssh|/usr/bin/scponly)$' /etc/passwd serviceaccount:x:1100:1100::/home/service:/sbin/nologin alice:x:1001:1001::/home/alice:/bin/rbash ``` Verify allowed login shells Confirm which shells are permitted by the system by checking the canonical list; run and read the output like this: ```bash cat /etc/shells /bin/sh /bin/bash /bin/rbash /usr/bin/zsh ``` Inspect a live session When the user is logged in, inspect processes and the actual command line used by the shell to detect if bash was launched as "rbash" or with a restricted flag; example commands: ```bash ps -u alice -o pid,cmd # pick a PID from the list, then tr '\0' ' ' < /proc/12345/cmdline ``` Change or remove shell access If the shell is inappropriate you can change it; for example to disable login set the shell to nologin, or to grant a normal shell use chsh or usermod: ```bash sudo usermod -s /sbin/nologin alice sudo chsh -s /bin/bash alice ``` Broader controls beyond /etc/passwd Remember that login behavior may also be controlled by SSH configuration, PAM rules, forced commands, chroot environments, or shell wrappers, so a shell listed in /etc/passwd is necessary but not always sufficient to determine actual permissions. Wrap-up and next steps You now know how to "look, check, and act" when shells impose restrictions; continue by practicing on a lab VM, review PAM and sshd configuration, and consider formal training to deepen your skills at bitsandbytes.academy when preparing for CompTIA Linux+ or LPIC-1. Join Bits & Bytes Academy First class LINUX exam preparation. security utilities setup troubleshooting