a small question in relation to bash, I would like my computer to shutdown after finishing a script.
Essentially something like this:
script.sh; sudo shutdown -hP now
The problem is, I would like to insert the root password at the time I am executing the above command, and not after the script exits.
Furthermore, I would prefer not running the script as root.
Nikos78 wrote:
> Hello community,
>
>
> a small question in relation to bash, I would like my computer to
> shutdown after finishing a script.
> Essentially something like this:
>
> Code:
> --------------------
> script.sh; sudo shutdown -hP now
> --------------------
>
> The problem is, I would like to insert the root password at the time I
> am executing the above command, and not after the script exits.
> Furthermore, I would prefer not running the script as root.
I suppose the easiest solution would be to edit /etc/sudoers to allow
the user that runs the script to issue that shutdown command without
giving a password. Is that a solution that works for you?
If I can restrict the “no password requirement” to the shutdown command, I think it is a fair workaround. Any suggestions as to how I would be doing that?
Nikos78 wrote:
> djh-novell;2568001 Wrote:
>> Nikos78 wrote:
>>> Hello community,
>>>
>>>
>>> a small question in relation to bash, I would like my computer to
>>> shutdown after finishing a script.
>>> Essentially something like this:
>>>
>>> Code:
>>> --------------------
>>> script.sh; sudo shutdown -hP now
>>> --------------------
>>>
>>> The problem is, I would like to insert the root password at the time
>> I
>>> am executing the above command, and not after the script exits.
>>> Furthermore, I would prefer not running the script as root.
>> I suppose the easiest solution would be to edit /etc/sudoers to allow
>> the user that runs the script to issue that shutdown command without
>> giving a password. Is that a solution that works for you?
>
> If I can restrict the “no password requirement” to the shutdown
> command, I think it is a fair workaround. Any suggestions as to how I
> would be doing that?