minimize use of root account

Yudi V yudi.tux at gmail.com
Fri Feb 19 05:29:45 UTC 2016


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


More information about the freebsd-questions mailing list