From owner-freebsd-questions@FreeBSD.ORG Thu Sep 27 01:18:57 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C37C1106564A for ; Thu, 27 Sep 2012 01:18:57 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) by mx1.freebsd.org (Postfix) with ESMTP id 834768FC0C for ; Thu, 27 Sep 2012 01:18:57 +0000 (UTC) Received: from r56.edvax.de (port-92-195-214-70.dynamic.qsc.de [92.195.214.70]) by mx02.qsc.de (Postfix) with ESMTP id 415C827D8D; Thu, 27 Sep 2012 03:18:50 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id q8R1InrN003009; Thu, 27 Sep 2012 03:18:49 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Thu, 27 Sep 2012 03:18:49 +0200 From: Polytropon To: freebsd@dreamchaser.org Message-Id: <20120927031849.f3496a43.freebsd@edvax.de> In-Reply-To: <5063A68A.8090107@dreamchaser.org> References: <5063A68A.8090107@dreamchaser.org> Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: FreeBSD Mailing List Subject: Re: bad root shell in /etc/passwd X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 01:18:57 -0000 On Wed, 26 Sep 2012 19:06:18 -0600, Gary Aitken wrote: > I mistakenly changed the root shell to something which doesn't exist. > Was trying to make it bash and used /bin/bash instead of /usr/local/bin/bash. A typical Linuxism. :-) > As a consequence, all login attempts fail because the shell can't be found. That's why you should be using the "toor" account and leave "root" unchanged. Some may say that as soon as you're changing the root shell because you're doing much work as root, you're obvuously doing something wrong. :-) Also note that tools like su ("su -m", "su -") and super are in many cases better suited for making the CLI environment more comfortable than changing the shell of the root account. > Unfortunatley, I shut down the session in which I modified /etc/passwd and > I don't have a root shell running anywhere, so I can't fix it. Maybe without rebooting you can do this: Enter "su -m" (if your non-root user is allowed to su root, then enter "chsh" and set the root shell back to the default. > I'm concerned that booting single user will have the same problem. When you can successfully boot into SUM, you will be prompted for the shell to start. /bin/sh is the default shell (even though it is a quite ugly dialog shell -- still it's considered a "maintenance and emergency use only shell" at this point. It will be powerful enough to call the "chsh" command to get root back into normal condition. > Or will it fall back to /bin/sh? No, you will be prompted for the shell to be executed. > guidance? Try the "su -m" trick first. If it doesn't work: Reboot into SUM, and at the Enter full pathname of shell or RETURN for /bin/sh: prompt, press RETURN. In worst case (e. g. if you have accidentally damaged /bin/sh, maybe by overwriting it with a dynamically linked bash), you could type "/rescue/sh" instead. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...