[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mass user property changes



Dave Ewart wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

theal wrote:

I need to change the shell on 25+ users from /bin/false to /bin/passwd

what is the best way to do this? Can I simply do a search and replace
while editing /etc/passwd?


Technically, that's probably not the Right Way, but so long as nothing
else is writing to /etc/passwd at the same time, it ought to be fine :-)

The Right Way is something like this:

for a in `grep '/bin/false' /etc/passwd| cut -f 1 -d ':'`; do usermod -s
/bin/passwd $a; done

(completely untested)

Dave.

this may be a better solution. We probably dont want to give all the system accounts a valid shell.

for USER in user1 user2 user3
do
usermod -s /bin/sh $USER
done



Reply to: