From nobody Thu Aug 19 06:25:11 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1FB43177424B for ; Thu, 19 Aug 2021 06:25:15 +0000 (UTC) (envelope-from ari@ish.com.au) Received: from mail.ish.com.au (mail.ish.com.au [203.29.62.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gqvrq0Mtyz3LdB for ; Thu, 19 Aug 2021 06:25:14 +0000 (UTC) (envelope-from ari@ish.com.au) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ish.com.au; s=mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References: Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=12Z9gCx0zqWSdaW2fuFNM8mo4R4mtUXYYIOeoh8crDM=; b=2SOq+DYWXlo58xZYkZKbPJn3mh pKiXYW7Nnq+MsawQCYocTwFQOaPtBeBiSheG/QWUfWMKi2zOrNTffL0OwoSenL+D1JHVvZK/zBrWO 7KmT0/tvsPkDZSm+RAn3ZEPxZIOQKcnNNAv+JqqKsjofidWmcBRqQbUqwESCw3RLd4Dde3ngwwzxq o+n8WwtbuzuUZPkJFr3tj2d31pPH10Dd910+iuQ6t/hHIn3EbmV3qDGcpp27QzkDC2WcCIcr4MxHU PzXdj1rUDgb58HVqvh1eZFLXWrIj8F+iHHtlrol44+Acv7TrKbOqaZSNsANmFpHCulmGL8z96kFmf up1iqtNw==; Received: from [10.242.2.3] by mail.ish.com.au with esmtpsa (TLS1.3) tls TLS_AES_128_GCM_SHA256 (Exim 4.94.2 (FreeBSD)) (envelope-from ) id 1mGbUF-000JW8-Np; Thu, 19 Aug 2021 16:25:11 +1000 Message-ID: Date: Thu, 19 Aug 2021 16:25:11 +1000 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:92.0) Gecko/20100101 Thunderbird/92.0 Subject: Re: Run script as root without sudo Content-Language: en-AU To: Jonathan Chen Cc: freebsd-stable References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Gqvrq0Mtyz3LdB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Reply-To: ari@ish.com.au From: Aristedes Maniatis via freebsd-stable X-Original-From: Aristedes Maniatis X-ThisMailContainsUnwantedMimeParts: N That would require root to put the file there and then to reboot the machine. Ari On 19/8/21 4:16pm, Jonathan Chen wrote: > On Thu, 19 Aug 2021 at 17:33, Aristedes Maniatis via freebsd-stable > wrote: > [...] >> How else can I get this script running as root remotely in a completely >> unattended way? > The way it's usually done is with an rc script in /usr/local/etc/rc.d, eg: > /usr/local/etc/rc.d/myscript > > and add the entry into /etc/rc.conf: > myscript_enable="YES" > > The FreeBSD AWS instances uses this method to auto-install required packages. > > Cheers.