On Thu, Aug 25, 2005 at 02:23:04PM -0400, 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?

There may be a safer way to do this, a la visudo (i.e., a
program that makes sure you don't make syntactic mistakes),
but this should do the trick:

sudo sed -i -e 's/\/bin\/false/\/bin\/passwd/g' /etc/passwd

That will change *every* occurrence of '/bin/false' within
/etc/passwd to '/bin/passwd'. There are variations on this
that will, say, only change shells for certain users. But if
changing every instance is what you want, that will do it
and is probably the easiest way. The Perl route --

sudo perl -p -i -e 's{/bin/false}{/bin/passwd}g' /etc/passwd

-- looks a little cleaner.

-- 
Stephen R. Laniel
[EMAIL PROTECTED]
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key

Attachment: signature.asc
Description: Digital signature

Reply via email to