windows runafterjob fails (system permissions)

73 views
Skip to first unread message

dave.br...@gmail.com

unread,
Sep 23, 2016, 2:41:41 PM9/23/16
to bareos-users
I am running a bat script that needs admin permissions to work and it seems like Bareos (windows ver bareos-dir Version: 15.2.2) runs in with local system credentials. I have tested my script running as domain admin and local system and am successful running as domain\admin, when I run as local system I get the same error as seen below.

This is the message I get from bconsole when running the bat file:

23-Sep 13:30 bareos-dir JobId 589: AfterJob:
23-Sep 13:30 bareos-dir JobId 589: AfterJob: Unhandled Exception: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
23-Sep 13:30 bareos-dir JobId 589: AfterJob: at system.Windows.Forms.Form.ShowDialog(IWin32Window owner)
23-Sep 13:30 bareos-dir JobId 589: AfterJob: at o.get_d()
23-Sep 13:30 bareos-dir JobId 589: AfterJob: at o.b()
23-Sep 13:30 bareos-dir JobId 589: AfterJob: at il.Main(String[] args)

Is there anyway to run a script with domain administrator privileges or suggestions for a workaround?

Thanks in advance,

Dave

Stefan Klatt

unread,
Sep 24, 2016, 7:43:20 AM9/24/16
to bareos...@googlegroups.com
Hi Dave,

what about running bareos-fd service with domain rights?

Regards

Stefan
--
*CaC, Computer and Communication*
Inhaber Stefan Klatt
End-2-End Senior Network Consultant
Triftstrasse 9
60528 Frankfurt
Germany
USt-IdNr.: DE260461592

Tel.: +49-(0)172-6807809
Tel.: +49-(0)69-67808-900
Fax: +49-(0)69-67808-837
Email: stefan...@cac-netzwerk.de
Profil: http://www.cac-netzwerk.de/profil

signature.asc

Bruno Friedmann

unread,
Sep 24, 2016, 10:34:31 AM9/24/16
to bareos...@googlegroups.com
I would avoid the domain\admin account and still run as service, but I would
dig to have a script that doesn't need to interact at all with desktop.
Here's the error seems that it need a modal dialog box ???
In last resort, there's an option in service tabs to allow it to interact with
desktop check the option.

--

Bruno Friedmann
Ioda-Net Sàrl www.ioda-net.ch
Bareos Partner, openSUSE Member, fsfe fellowship
GPG KEY : D5C9B751C4653227
irc: tigerfoot

openSUSE Tumbleweed
Linux 4.7.4-1-default x86_64 GNU/Linux, nvidia: 367.44
Qt: 5.6.1, KDE Frameworks: 5.26.0, Plasma: 5.7.4, kmail2 5.3.0 (QtWebEngine)

Dave Bright

unread,
Sep 26, 2016, 8:26:05 AM9/26/16
to Bruno Friedmann, bareos...@googlegroups.com
Thanks for both your suggestions but to be more specific I am attempting
to run a amazon glacier sync tool from a bat file.

If i run it as a "windows scheduled task" as administrator it will run
If I run it locally as administrator it will run.

If I run it from bareos it will fail
If I run it as anything other than the Administrator it will fail.


When I run it through Bareos I will get the following error:
26-Sep 07:55 bareos-dir JobId 606: shell command: run AfterJob
"C:/Progra~1/FastGlacier/test.bat"
26-Sep 07:55 bareos-dir JobId 606: AfterJob:
26-Sep 07:55 bareos-dir JobId 606: AfterJob: C:\Windows\system32>cd
C:\Program Files\FastGlacier\
26-Sep 07:55 bareos-dir JobId 606: AfterJob:
26-Sep 07:55 bareos-dir JobId 606: AfterJob: C:\Program
Files\FastGlacier>glacier-sync GlacierUserName:GlacierPassword
"D:\bareos-storage\bareos" us-west-2 "Bareos" nchds
26-Sep 07:55 bareos-dir JobId 606: AfterJob:
26-Sep 07:55 bareos-dir JobId 606: AfterJob: Unhandled Exception:
System.InvalidOperationException: Showing a modal dialog box or form
when the application is not
running in UserInteractive mode is not a valid operation. Specify the
ServiceNotification or DefaultDesktopOnly style to display a
notification from a service application.
26-Sep 07:55 bareos-dir JobId 606: AfterJob: at
System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
26-Sep 07:55 bareos-dir JobId 606: AfterJob: at o.get_d()
26-Sep 07:55 bareos-dir JobId 606: AfterJob: at o.b()
26-Sep 07:55 bareos-dir JobId 606: AfterJob: at il.Main(String[]
args)
26-Sep 07:55 bareos-dir JobId 606: Error: Runscript: AfterJob returned
non-zero status=255. ERR=Unknown error
*

When looking on fastglaciers site they show this on their FAQ:
Question -When I try to run glacier-sync.exe (glacier-put.exe) I get the
following error if the user not is logged on:
Unhandled Exception: System.InvalidOperationException: Showing a modal
dialog box or form when the application is not running in
UserInteractive mode is not a valid operation. Specify the
ServiceNotification or DefaultDesktopOnly style to display a
notification from a service application.

Answer -The settings are stored in user profile, when you start console
tools from the task scheduler, they usually start under the local
service account and FastGlacier is unable to find configuration file.
You may try to change the account that is used to start scheduled task,
open Windows Task Scheduler, Task properties and specify the account
that was used to configure FastGlacier GUI.

I have tried setting the fd as the Administrator and unfortunately still
get the above error. My guess is that changing the "Bareos file backup
service" does not change how this script is run.....perhaps it is
another service I nee to change though I have read that changing
services is not recommend and bareos is intentionally set to run as
system.

As far as interactive mode goes I don’t really need or want it as it
defeats the purpose of automation. My understanding is that the reason
this message is displayed it because if you are running as a user other
than the user that you installed as it will not be able to find the
config file and will attempt to run in gui mode so you can enter in your
connection to glacier.

Thanks in advanced for any ideas, I really like Bareos but I am just a
novice with this.

Dave
>--
>You received this message because you are subscribed to a topic in the
>Google Groups "bareos-users" group.
>To unsubscribe from this topic, visit
>https://groups.google.com/d/topic/bareos-users/yGuiU5jADoo/unsubscribe.
>To unsubscribe from this group and all its topics, send an email to
>bareos-users...@googlegroups.com.
>To post to this group, send email to bareos...@googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

dave.br...@gmail.com

unread,
Sep 26, 2016, 8:46:32 AM9/26/16
to bareos-users

I realized that I when I ran the last test as Bareos-fd as administrator, I was running it as a “RunAfterJob” and decided to reboot and try it as the more appropriate “ClientRunAfterJob” and this works! One noticeable issue is that the Bareos FD did not start up after reboot. Is there any other issues that I could run into if I continue to run as administrator?
Reply all
Reply to author
Forward
0 new messages