E
E
EvgeN_862018-07-19 19:43:21
bash
EvgeN_86, 2018-07-19 19:43:21

How to autorun bash script from user account as root?

there is a very simple bach script. It contains the launch of RDP and the init 0 command, which shuts down the computer when you exit RDP. Everything works on behalf of root, and RDP starts and when the session ends, the computer goes out, when you start it on behalf of the user, the computer does not turn off when the session ends. Question - how to start the script from under the user's account but with root rights so that init 0 will work?
@reboot /bin/1.bash registered in crontab (no sense)
Thank you in advance to all Linux owners. Very necessary

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SOTVM, 2018-07-19
@sotvm

sudo

C
CityCat4, 2018-07-20
@CityCat4

how to start a script from under the user's account but with root rights so that init 0 will work?

No way.
You need:
- man sudo
- changing the task statement
- a new script
- if something went wrong, go to step 1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question