From owner-freebsd-hackers@freebsd.org Sun Apr 2 11:29:31 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2CBFD2A6F3 for ; Sun, 2 Apr 2017 11:29:31 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay02.ispgateway.de (smtprelay02.ispgateway.de [80.67.18.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 766B762A for ; Sun, 2 Apr 2017 11:29:30 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from [78.35.156.238] (helo=fabiankeil.de) by smtprelay02.ispgateway.de with esmtpsa (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.84) (envelope-from ) id 1cudSy-0007Pr-Be for freebsd-hackers@freebsd.org; Sun, 02 Apr 2017 13:14:40 +0200 Date: Sun, 2 Apr 2017 13:14:40 +0200 From: Fabian Keil To: freebsd-hackers@freebsd.org Subject: Re: at home server without screen blocked by bad ipfw conf -- live boot usb with sshd Message-ID: <20170402130647.2f063868@fabiankeil.de> In-Reply-To: <1491049373.5625.1.camel@ovh.fr> References: <1491049373.5625.1.camel@ovh.fr> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/6UbptWHF7g4Y_A0Jm38QqCu"; protocol="application/pgp-signature" X-Df-Sender: Nzc1MDY3 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Apr 2017 11:29:31 -0000 --Sig_/6UbptWHF7g4Y_A0Jm38QqCu Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Orka Edison wrote: > i brink my at home by a bad ipfw.rules... >=20 > how can i cr=C3=A9ate an usb boot key with sshd for access to my server ? > with an fixed IP and tools-box for repair my machine. I use a script to adjust the UFS partition on an image created by the "memstick" target after it has been copied to the USB stick. The relevant script content: set -e -x mount "${device}" /mnt/ [...] mkdir -p /mnt/root/.ssh echo 'ssh-ed25519 [...]' > /mnt/root/.ssh/authorized_keys chmod -R go-rwx /mnt/root/.ssh echo 'PermitRootLogin yes' >> /mnt/etc/ssh/sshd_config echo 'ifconfig_re0=3D192.168.5.48' >> /mnt/etc/rc.conf echo 'sshd_enable=3D"YES"' >> /mnt/etc/rc.conf sed -e 's@ro,@rw,@' -i.bak /mnt/etc/fstab cat /mnt/etc/fstab umount /mnt You'll have to add your own public ssh key, adjust the rc.conf modification and maybe add a default router if needed. If you simply messed up the ipfw rules the memstick image should contain everything you need to fix it. If you are in a hurry and don't mind using unreproducible binaries built by third parties you could download a memstick image from freebsd.org instead of building it yourself. Fabian --Sig_/6UbptWHF7g4Y_A0Jm38QqCu Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQTKUNd6H/m3+ByGULIFiohV/3dUnQUCWODdIAAKCRAFiohV/3dU nSKGAJ9LlfcbYnwUTHyzjWn4q36I5WK+GACgmpMqT9YysrCbIQCH5Rtomab7K9A= =1veK -----END PGP SIGNATURE----- --Sig_/6UbptWHF7g4Y_A0Jm38QqCu--