Re: Preventing the computer from shutting down.

2015-01-15 Thread Rob Owens
On Fri, Oct 31, 2014 at 04:10:11PM -0600, Mario Castelán Castro wrote:
> Thanks everybody for their help. I will use molly-guard to guard
> from accidental shut down from the CLI. Is there something like
> molly-guard for the LXDE power off/close session button?.
> 
> I must clarify that what I mean by “preventing the computer from
> shutting down” is preventing the operator from inadvertently
> shutting down or rebooting the system while it is undergoing a
> backup.

I know this is an old thread, but here's something that might work.

I have a Wheezy system running LXDE and if you try to shut down using
the gui while another user is logged in, it refuses.  Actually, I think
it requests the root password.

So if your backup process involves an ssh login of a regular user (uid
of 1000 or greater), other users won't be able to shut down the computer
by normal gui methods.

-Rob


signature.asc
Description: Digital signature


Re: Preventing the computer from shutting down.

2014-10-31 Thread Mario Castelán Castro
Thanks everybody for their help. I will use molly-guard to guard from 
accidental shut down from the CLI. Is there something like molly-guard 
for the LXDE power off/close session button?.


I must clarify that what I mean by “preventing the computer from 
shutting down” is preventing the operator from inadvertently shutting 
down or rebooting the system while it is undergoing a backup.



--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Archive: https://lists.debian.org/545408c3.1090...@yandex.com



Re: Preventing the computer from shutting down.

2014-10-31 Thread Michael Biebl
Am 31.10.2014 um 07:07 schrieb Don Armstrong:
> On Thu, 30 Oct 2014, Joey Hess wrote:
>> Don Armstrong wrote:
>>> systemd-inhibit --who='backup script' --why='backup is running currently' \
>>>  --mode=block yourbackupscript;
>>
>> This doesn't currently prevent either /sbin/shutdown or eg, the
>> lightdm menu item from shutting the system down. It does inhibit
>> systemctl reboot/halt.
> 
> Huh. That seems kind of unfortunate (and weird, because /sbin/shutdown
> is symlinked to systemctl here; I would have expected /sbin/shutdown to
> be a special case of systemctl halt.)
> 
> This is probably at least a documentation bug, and possibly a real bug.

That sounds like a real bug, yes. And worth bringing up upstream.

Feel free to file a bug against the Debian package, so we don't forget
about this.



-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?



signature.asc
Description: OpenPGP digital signature


Re: Preventing the computer from shutting down.

2014-10-31 Thread lee
Mario Castelán Castro  writes:

> Hello.
>
> I can set up a script for backup with cron or anacron, but how can I
> prevent the computer from shutting down while the backup is being
> performed so as to not to leave it incomplete?.

I'd try to fix the bug that makes it shut down.  Do you have broken
hardware or power failures, or is there something running that randomly
shuts it down?


PS: Look into /etc/X11 for some freedesktop.org directory.  It may have
some policy xml files you could modify to disable the shutdown.


-- 
Again we must be afraid of speaking of daemons for fear that daemons
might swallow us.  Finally, this fear has become reasonable.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/87fve46qxl@gulltop.yagibdah.de



Re: Preventing the computer from shutting down.

2014-10-31 Thread martin f krafft
also sprach Karl E. Jorgensen  [2014-10-31 09:21 +0100]:
> Personally, I would have preferred molly-guard to use dpkg-divert,
> but it works as it is.

It does, since 0.5-1, but that needs to be uploaded still. I am
checking…

-- 
 .''`.   martin f. krafft  @martinkrafft
: :'  :  proud Debian developer
`. `'`   http://people.debian.org/~madduck
  `-  Debian - when you have better things to do than fixing systems
 
"syntactic sugar causes cancer of the semicolon."
-- epigrams in programming


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)


Re: Preventing the computer from shutting down.

2014-10-31 Thread Karl E. Jorgensen
Hi

On Thu, Oct 30, 2014 at 11:07:27PM -0700, Don Armstrong wrote:
> On Thu, 30 Oct 2014, Joey Hess wrote:
> > Don Armstrong wrote:
> > > systemd-inhibit --who='backup script' --why='backup is running currently' 
> > > \
> > >  --mode=block yourbackupscript;
> > 
> > This doesn't currently prevent either /sbin/shutdown or eg, the
> > lightdm menu item from shutting the system down. It does inhibit
> > systemctl reboot/halt.
> 
> Huh. That seems kind of unfortunate (and weird, because /sbin/shutdown
> is symlinked to systemctl here; I would have expected /sbin/shutdown to
> be a special case of systemctl halt.)

molly-guard doesn't really mess with /sbin/shutdown and
family. Instead it implements, e.g. /usr/sbin/shutdown.  Since
/usr/sbin precedes /sbin in $PATH this allows them to be overridden.

A bit clumsy, I agree, but sufficient to prevent administrator
mistakes.

Personally, I would have preferred molly-guard to use dpkg-divert, but
it works as it is.

> This is probably at least a documentation bug, and possibly a real bug.

In the case of molly-guard, I belive that is up for debate.

It only intentds to be a safety net, not a security feature.  After
all, attempting to protect a system against the root user is
nonsensical.

Regards
-- 
Karl E. Jorgensen


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20141031082118.GA22377@hawking



Re: Preventing the computer from shutting down.

2014-10-30 Thread Raffaele Morelli
On 30/10/14 at 12:11pm, Mario Castelán Castro wrote:
> Hello.
> 
> I can set up a script for backup with cron or anacron, but how can I prevent
> the computer from shutting down while the backup is being performed so as to
> not to leave it incomplete?.
> 
> Regards.

If I understand you request you could add some lines to you script in order to 
terminate your login manager, run your backup and then shutdown if and only if
your backup script is not currently being executed.


-- 
« Nunc est bibendum, nunc pede libero pulsanda tellus »


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20141031064921.gb1...@gmail.com



Re: Preventing the computer from shutting down.

2014-10-30 Thread Don Armstrong
On Thu, 30 Oct 2014, Joey Hess wrote:
> Don Armstrong wrote:
> > systemd-inhibit --who='backup script' --why='backup is running currently' \
> >  --mode=block yourbackupscript;
> 
> This doesn't currently prevent either /sbin/shutdown or eg, the
> lightdm menu item from shutting the system down. It does inhibit
> systemctl reboot/halt.

Huh. That seems kind of unfortunate (and weird, because /sbin/shutdown
is symlinked to systemctl here; I would have expected /sbin/shutdown to
be a special case of systemctl halt.)

This is probably at least a documentation bug, and possibly a real bug.

-- 
Don Armstrong  http://www.donarmstrong.com

Life would be way easier
if I were easier.
 -- a softer world #473
http://www.asofterworld.com/index.php?id=473


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20141031060727.gi14...@teltox.donarmstrong.com



Re: Preventing the computer from shutting down.

2014-10-30 Thread Karl E. Jorgensen
Hi

On Thu, Oct 30, 2014 at 02:02:49PM -0600, Mario Castelán Castro wrote:
> Thanks you Doug, Don and Laurent. Is there a less hacky way to do
> this using the default init system in wheezy?

I think that you can get *some* of the way by installing the
molly-guard package.

Although molly-guard is primarily aimed towards preventing system
administrators from blowing their feet off, it does allow the system
adminstrator to add in scripts in /etc/molly-guard/run.d which can
prevent "shutdown" or "poweroff" from working.

It's a safety net - not a guarantee. And it is reasonably simple to
bypass by a half-competent admin.

I doubt this affects the LXDE power off button though. (I do not use
LXDE).

Hope this helps

-- 
Karl E. Jorgensen


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20141030224748.GB24198@hawking



Re: Preventing the computer from shutting down.

2014-10-30 Thread Mario Castelán Castro
Thanks you Doug, Don and Laurent. Is there a less hacky way to do this 
using the default init system in wheezy?



--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Archive: https://lists.debian.org/54529969.8030...@yandex.com



Re: Preventing the computer from shutting down.

2014-10-30 Thread Joey Hess
Don Armstrong wrote:
> On Thu, 30 Oct 2014, Mario Castelán Castro wrote:
> > I can set up a script for backup with cron or anacron, but how can I
> > prevent the computer from shutting down while the backup is being
> > performed so as to not to leave it incomplete?.
> 
> If you're using systemd, this can be done using systemd-inhibit. See
> http://www.freedesktop.org/software/systemd/man/systemd-inhibit.html
> for details.
> 
> Quickly:
> 
> systemd-inhibit --who='backup script' --why='backup is running currently' \
>  --mode=block yourbackupscript;

This doesn't currently prevent either /sbin/shutdown or eg, the lightdm
menu item from shutting the system down. It does inhibit systemctl reboot/halt.

-- 
see shy jo


signature.asc
Description: Digital signature


Re: Preventing the computer from shutting down.

2014-10-30 Thread Mario Castelán Castro

El 30/10/14 12:31, Doug escribió:

On 10/30/2014 02:11 PM, Mario Castelán Castro wrote:

Hello.

I can set up a script for backup with cron or anacron, but how can I
prevent the computer from shutting down while the backup is being
performed so as to not to leave it incomplete?.

Regards.



One simple way that does not require any coding at all is to buy a small
device called a "Mouse Jiggler" which seems to sell for about $16. It is a
usb dongle thing that moves the "mouse" a very tine bit continuously.It
does not prevent use of the actual mouse while it is jiggling, btw. I
see by
Google there is some small app that can be applied to a Windows system
that will do the same thing without the plug-in gadget. It was made, I
think, so
you could watch a movie without having to move the mouse every so often.
I'm sure someone must have written something for Linux which would be what
you're looking for, but the pclos repo doesn't seem to have it.
Meanwhile the hardware solution works perfectly.

--doug


Thanks you for the answer, but it don't solves my problem. I should have 
explained my request better. What I want to accomplish is to disable 
shutting down the computer through the LXDE button and through the 
command line with poweroff/halt/shutdown. Ideally all means to shut down 
the computer would display a message that a backup is being performed, 
instead of shutting it down, bout would still allow me (any user who 
normally would be able to shut down the computer) to force a shutdown or 
restart.


Regards.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Archive: https://lists.debian.org/54528612.7090...@yandex.com



Preventing the computer from shutting down.

2014-10-30 Thread Mario Castelán Castro

Hello.

I can set up a script for backup with cron or anacron, but how can I 
prevent the computer from shutting down while the backup is being 
performed so as to not to leave it incomplete?.


Regards.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Archive: https://lists.debian.org/54527f4d.9040...@yandex.com



Re: Preventing the computer from shutting down.

2014-10-30 Thread Laurent Bigonville
Le Thu, 30 Oct 2014 12:11:25 -0600,
Mario Castelán Castro  a écrit :

> Hello.

Hello,

> I can set up a script for backup with cron or anacron, but how can I 
> prevent the computer from shutting down while the backup is being 
> performed so as to not to leave it incomplete?.

If you are using systemd, you can use systemd-inhibit command to do
this.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20141030200816.6d780...@fornost.bigon.be



Re: Preventing the computer from shutting down.

2014-10-30 Thread Don Armstrong
On Thu, 30 Oct 2014, Mario Castelán Castro wrote:
> I can set up a script for backup with cron or anacron, but how can I
> prevent the computer from shutting down while the backup is being
> performed so as to not to leave it incomplete?.

If you're using systemd, this can be done using systemd-inhibit. See
http://www.freedesktop.org/software/systemd/man/systemd-inhibit.html
for details.

Quickly:

systemd-inhibit --who='backup script' --why='backup is running currently' \
 --mode=block yourbackupscript;

Otherwise, you can add in an init scripts which runs in rc6 and rc0, and
blocks until the backup is done. That's kind of hacky, but should work.

-- 
Don Armstrong  http://www.donarmstrong.com

I cannot find rest
Because I am powerless
To amend a broken world.
 -- Guy Gavriel Kay _Under Heaven_ p295


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20141030190653.ge14...@teltox.donarmstrong.com



Re: Preventing the computer from shutting down.

2014-10-30 Thread Doug

On 10/30/2014 02:11 PM, Mario Castelán Castro wrote:

Hello.

I can set up a script for backup with cron or anacron, but how can I prevent 
the computer from shutting down while the backup is being performed so as to 
not to leave it incomplete?.

Regards.



One simple way that does not require any coding at all is to buy a small device called a 
"Mouse Jiggler" which seems to sell for about $16. It is a
usb dongle thing that moves the "mouse" a very tine bit continuously.It does 
not prevent use of the actual mouse while it is jiggling, btw. I see by
Google there is some small app that can be applied to a Windows system that 
will do the same thing without the plug-in gadget. It was made, I think, so
you could watch a movie without having to move the mouse every so often. I'm 
sure someone must have written something for Linux which would be what
you're looking for, but the pclos repo doesn't seem to have it. Meanwhile the 
hardware solution works perfectly.

--doug


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Archive: https://lists.debian.org/545283f7.10...@optonline.net