How to change all /bin/bash at /etc/passwd to /sbin/nologin?

up at up at
Mon Oct 9 13:23:15 PDT 2006

I would not recommend using vipw or sed to change your users' shells.

I'd just create a file of users:

cat /etc/passwd | cut -f1 -d":" > userlist

(Edit out any users you don't want to include):

then a scipt using pw to change their shells


user=`awk '{print $1}' ./userlist`
for user in $user
    pw usermod $user -s /sbin/nologin

James Smallacombe		      PlantageNet, Inc. CEO and Janitor
up at	

More information about the freebsd-questions mailing list