Bacula-users

Re: [Bacula-users] bacula-fd cannot access files from the system still getting [permission denied]

2015-08-13 07:19:58
Subject: Re: [Bacula-users] bacula-fd cannot access files from the system still getting [permission denied]
From: Josip Deanovic <djosip+news AT linuxpages DOT net>
To: bacula-users AT lists.sourceforge DOT net
Date: Thu, 13 Aug 2015 13:15:13 +0200
On Tuesday 2015-08-11 17:40:17 Jing Yang wrote:
> Here is my init.d script file, i did not see the -u option …. BUSER and
> BGROUP are the two things some other mailing list user told me to put
> there, however, that does not work either.

Hi!

I am not sure what OS you are using so my advice here could probably
be improved if you use the solution more suitable for your system.

If you just want to start the bacula-fd daemon using that init script
and see how it works you can modify this line:
 ARGS="-c /etc/bacula/${NAME}.conf"
so that it looks like this:
 ARGS="-c /etc/bacula/${NAME}.conf -u root -g root"

The content of the ARGS variable is later in the function do_start()
passed to the command which will execute the bacula-fd daemon.

After starting bacula-fd using that modified init script, bacula-fd
should run as root. You can check the process list as before to
ensure that.

Again, most systems support some procedure that can be used to
source (include) additional file with additional options and
variables.

I would suggest that you find the best way to supply additional
parameters to the init scripts on your system because modified
init scripts are likely to be overwritten during the update of
the related package.


> #!/bin/sh
> ### BEGIN INIT INFO
> # Provides:          bacula-fd
> # Required-Start:    $remote_fs $syslog
> # Required-Stop:     $remote_fs $syslog
> # Should-Start:      bacula-sd
> # Should-Stop:       bacula-sd
> # Default-Start:     2 3 4 5
> # Default-Stop:      0 1 6
> ### END INIT INFO
> #
> # bacula-fd     SysV init script for Bacula-FD.
> #
> #       Written by Miquel van Smoorenburg <miquels AT cistron DOT nl>.
> #       Modified for Debian GNU/Linux by Ian Murdock
> <imurdock AT gnu.ai.mit DOT edu>. #       Customized for Bacula by Jose Luis
> Tallon <jltallon AT adv-solutions DOT net> #
> 
> . /lib/lsb/init-functions
> 
> NAME="bacula-fd"
> DESC="Bacula File daemon"
> PATH=/sbin:/bin:/usr/sbin:/usr/bin
> DAEMON=/usr/sbin/${NAME}
> BUSER=root
> BGROUP=root
> PORT=9102
> ARGS="-c /etc/bacula/${NAME}.conf"
> 
> test -f $DAEMON || exit 0
> 
> set -e
> 
> if [ -n "`getent services bacula-fd`" ]; then
>         PORT=`getent services bacula-fd | awk '{ gsub("/tcp","",$2);
> print $2; }'` fi
> 
> . /lib/lsb/init-functions
> . /usr/share/bacula-common/common-functions
> create_var_run_dir
> 
> PIDFILE=/var/run/bacula/$NAME.$PORT.pid
> 
> do_start()
> {
>         start-stop-daemon --start --quiet --pidfile $PIDFILE \
>         --exec $DAEMON -- $ARGS
> }
> 
> do_stop()
> {
>         start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
>         --exec $DAEMON
> }
> 
> case "$1" in
>   start)
>         if [ -f /etc/bacula/do_not_run ]; then
>                 log_failure_msg "Not starting $DESC: disabled via
> /etc/bacula/do_not_run" exit 0
>         fi
> 
>         log_daemon_msg "Starting $DESC..."
>         if do_start ; then
>                 log_end_msg 0
>         else
>                 log_end_msg 1
>         fi
>         ;;
>   stop)
>         log_daemon_msg "Stopping $DESC..."
>         if do_stop ; then
>                 log_end_msg 0
>         else
>                 log_end_msg 1
>         fi
>         ;;
> 
>   restart|force-reload)
>         $0 stop
>         sleep 1
>         $0 start
>         ;;
>   status)
>         status_of_proc -p $PIDFILE $DAEMON $NAME
>         ;;
>   *)
>         N=/etc/init.d/$NAME
>         echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
>         exit 1
>         ;;
> esac
> 
> exit 0


-- 
Josip Deanovic

------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
<Prev in Thread] Current Thread [Next in Thread>