From owner-freebsd-questions@freebsd.org Fri Feb 19 05:29:44 2016 Return-Path: Delivered-To: freebsd-questions@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 F271EAAD626 for ; Fri, 19 Feb 2016 05:29:44 +0000 (UTC) (envelope-from yudi.tux@gmail.com) Received: from mail-ig0-x22d.google.com (mail-ig0-x22d.google.com [IPv6:2607:f8b0:4001:c05::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB5981F60 for ; Fri, 19 Feb 2016 05:29:44 +0000 (UTC) (envelope-from yudi.tux@gmail.com) Received: by mail-ig0-x22d.google.com with SMTP id 5so29478582igt.0 for ; Thu, 18 Feb 2016 21:29:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=A40rWupqaqP0bGg065DS0WruiOnBX95YVs8HQK9vgxI=; b=ZyM1k8mUxLU+SGp8N74JL0XxnrAQb4WBmltX9W+s/JVpfvdtoBUJEjPN4VfQA90FPb tYNMIFfy5dd1XGWzTbU9K289m87vzR+COS/TZgRAEpHOkqcAn7n0DSNYlyb/utMV97rO V0X6DXHV/UQUqj92RYgrH9K/Q/l0UerKLjXeqef/Jecq/MiO53R7XIoLGU8rPKhcGumO DvKba+Oi8p5I/cOtbuChz/QGiSx7c3Pboo852HY4v5h9ihHozi0fUu73YGYi74D8rjKE CyMZ6g43pjDosnH/8cPb5ZavmeOw2ThoJyBH8cSfcSI9sDExoIfi4KDkqbX1d30EBFm3 MEbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=A40rWupqaqP0bGg065DS0WruiOnBX95YVs8HQK9vgxI=; b=cZ0deX+rCzM8WvgWlqxLfUNvCxyEDRtgu5LzYH8sLY4vnl6/QvPvqb2h/QMaA02PXR KLPelKvGf1u2yT5V4kZSlZ9oY7s1wAucJSbUoH3Wvw/n+lugN1sCWs1ujgEc9mINeBj3 d7WYlkWL56j4BHIdACVGovlUklPvpgQ5y9h5k1bd/n/G38Ksw2S4qPb4Yu4/dKvlrYF0 gp/kQgm5h4i/AQcRpkjk4VcRXC9cu+ekZQACNCQ3CClHL2D+4c8ffA/BvXmYjnJy8c2J T+vaBvYGmAXOkD/QE8mL+/74adEpBMMf0W4063RDQXgP1/8czoBvObdw+0rWbiaIL4ld 1Pjw== X-Gm-Message-State: AG10YOScYg3Pqgcxyrtw7HM+XVFMeHfcrlIMCaBHHH9XvqoL3azgWOxcIW8dBFiGV/EqCr/9TfG/oOi3QInM2Q== MIME-Version: 1.0 X-Received: by 10.50.33.81 with SMTP id p17mr6691628igi.75.1455859784025; Thu, 18 Feb 2016 21:29:44 -0800 (PST) Received: by 10.107.149.149 with HTTP; Thu, 18 Feb 2016 21:29:43 -0800 (PST) Date: Fri, 19 Feb 2016 16:29:43 +1100 Message-ID: Subject: minimize use of root account From: Yudi V To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2016 05:29:45 -0000 Hi all, currently I use the below script to load geli devices and import zpool. It needs to be run as root. how to run this script as normal user, is there a group that the user needs to be part of? also when I have to shutdown/reboot, I need to run the command as root but instead would like for the normal user to be able to shutdown and reboot. I posted this first on the forums but did not receive any relevant ans yet. https://forums.freebsd.org/threads/55166/ appreciate if someone can answer my questions. Code: ############### #!/bin/csh -f # attach geli containers geli attach /dev/label/dataE0 if ($status == 0) then geli attach /dev/label/dataE1 if ($status == 0) then # import zpool tank3 (on a 2-way mirror) zpool import tank3 # mount zfs datasets from tank3 zfs mount -a #start samba service samba_server restart else geli detach /dev/label/dataE0.eli echo detached dataE0.eli echo failed to attach dataE1.eli, check your password. endif else echo failed to attach dataE0.eli, check your password endif ################### -- Kind regards, Yudi