Date: Mon, 9 Oct 2006 10:03:38 +0200 From: Matthias Apitz <m.apitz@oclcpica.org> To: Lothar Braun <mail@lobraun.de> Cc: freebsd-questions@freebsd.org Subject: Re: How to change all /bin/bash at /etc/passwd to /sbin/nologin? Message-ID: <20061009080338.GA2184@rebelion.Sisis.de> In-Reply-To: <200610090941.41014.mail@lobraun.de> References: <38221ea10610090024l5f7aebdfp6c551e3955b9cc10@mail.gmail.com> <200610090941.41014.mail@lobraun.de>
next in thread | previous in thread | raw e-mail | index | archive | help
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@oclcpica.org> - w http://www.oclcpica.org/ http://guru.UnixLand.de/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061009080338.GA2184>