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

Matthias Apitz m.apitz at oclcpica.org
Mon Oct 9 01:03:44 PDT 2006


El día Monday, October 09, 2006 a las 09:41:38AM +0200, Lothar Braun escribió:

> Hi James,
> 
> On Monday 09 October 2006 09:24, James Corteciano wrote:
> > How to change all word lines of /bin/bash at /etc/passwd file to
> > /sbin/nologin in just  a single line command?
> 
> I think you can do this with:
> 
> sed 's!/bin/bash$!/sbin/nologin!' /etc/passwd > /etc/passwd

DONT DO THAT this way. The result would be that your actual
shell truncates the file '/etc/passwd' to zero length and
then launches the 'sed'.

In FreeBSD you must use 'vipw' (see its man page) and in the
vi launched by 'vipw' you may use something like:

:1,$s-/bin/bash$-/sbin/nologin-

Only do this if your familar with 'vi'.

	matthias
-- 
Matthias Apitz
Manager Technical Support - OCLC PICA GmbH
Gruenwalder Weg 28g - 82041 Oberhaching - Germany
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e <m.apitz at oclcpica.org> - w http://www.oclcpica.org/ http://guru.UnixLand.de/


More information about the freebsd-questions mailing list