[PLUG] Allow user to shutdown host

Rich Shepard rshepard at appl-ecosys.com
Wed Feb 27 22:51:16 UTC 2019


On Wed, 27 Feb 2019, Paul Heinlein wrote:

> My experience is that sudo expects the command line invocation to look
> like the sudo configuration. So what I'd do is add a function, not an
> alias, to .bashrc:
>
> function halt {
>  /sbin/shutdown -h now
> }
>
> But since "halt" is the name of an actual executable, maybe train her to use 
> something like "haltnow" and tweak the name of the function:
>
> function haltnow {
>  /sbin/shutdown -h now
> }

Paul,

Your experiences easily top my web search. :-) I read that if the sudo alias
has a space before the closing quote bash will pass the following command to
sudo.

The issue today seems to be that she typed
sudo /bin/halt
rather than
sudo /sbin/halt

I'll try both your haltnow function and the doit alias and report the
results ... probably over the weekend.

Many thanks,

Rich



More information about the PLUG mailing list