Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Feb 2016 16:29:43 +1100
From:      Yudi V <yudi.tux@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   minimize use of root account
Message-ID:  <CACo--mv9qU2ZwtTuZRQBpioEr%2BenT=sd-SJ79BFumZt5aL18jg@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACo--mv9qU2ZwtTuZRQBpioEr%2BenT=sd-SJ79BFumZt5aL18jg>