From owner-freebsd-questions@FreeBSD.ORG Mon Oct 9 08:03:44 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B49BC16A47B for ; Mon, 9 Oct 2006 08:03:44 +0000 (UTC) (envelope-from M.Apitz@oclcpica.org) Received: from mail.pica.nl (mail.pica.nl [192.87.44.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 48B4943D46 for ; Mon, 9 Oct 2006 08:03:42 +0000 (GMT) (envelope-from M.Apitz@oclcpica.org) Received: from rebelion.Sisis.de ([193.31.10.34]) by mail.pica.nl with Microsoft SMTPSVC(6.0.3790.1830); Mon, 9 Oct 2006 10:03:02 +0200 Received: (from guru@localhost) by rebelion.Sisis.de (8.13.4/8.13.4/Submit) id k9983cPn002375; Mon, 9 Oct 2006 10:03:38 +0200 (CEST) (envelope-from m.apitz@oclcpica.org) X-Authentication-Warning: rebelion.Sisis.de: guru set sender to m.apitz@oclcpica.org using -f Date: Mon, 9 Oct 2006 10:03:38 +0200 From: Matthias Apitz To: Lothar Braun Message-ID: <20061009080338.GA2184@rebelion.Sisis.de> References: <38221ea10610090024l5f7aebdfp6c551e3955b9cc10@mail.gmail.com> <200610090941.41014.mail@lobraun.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200610090941.41014.mail@lobraun.de> User-Agent: Mutt/1.4.2.1i X-Operating-System: FreeBSD 6.0-RELEASE (i386) X-OriginalArrivalTime: 09 Oct 2006 08:03:02.0560 (UTC) FILETIME=[57F0B200:01C6EB79] Cc: freebsd-questions@freebsd.org Subject: Re: How to change all /bin/bash at /etc/passwd to /sbin/nologin? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Matthias Apitz List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Oct 2006 08:03:44 -0000 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 - w http://www.oclcpica.org/ http://guru.UnixLand.de/