Launch an application at startup with root privileges

81 views
Skip to first unread message

Destroy

unread,
May 22, 2019, 7:41:04 AM5/22/19
to BeagleBoard
Hello,
I must to launch an application at startup with root privileges, I have found this
it work but without the privileges.
How can I resolve?

Thank you in advance.

Mark A. Yoder

unread,
May 22, 2019, 5:11:39 PM5/22/19
to BeagleBoard
If you run
sudo visudo

The add the following to the end.

debian ALL=(ALL) NOPASSWD: /path/to/command/to/start.sh

you can use sudo without giving a password.  I think then your ExecStart can be
ExecStart=sudo /usr/bin/scriptname.s

--Mark

Dennis Lee Bieber

unread,
May 23, 2019, 12:59:07 AM5/23/19
to beagl...@googlegroups.com
On Wed, 22 May 2019 14:11:39 -0700 (PDT), "Mark A. Yoder"
<mark.a...@gmail.com> declaimed the
following:

>If you run
>
>*sudo visudo*
>
>The add the following to the end.
>
>debian ALL=(ALL) NOPASSWD: /path/to/command/to/start.sh
>
>
>you can use *sudo* without giving a password. I think then your ExecStart
>can be
>
>ExecStart=sudo /usr/bin/scriptname.s
>

Why does all this seem to be a potential security leak? <G>

What is wrong with adding an entry in root's crontab using the @reboot
specification for when to run the job?

A Raspberry-Pi example, but should carry over to Beaglebone just as
well.
https://www.raspberrypi-spy.co.uk/2013/07/running-a-python-script-at-boot-using-cron/


--
Wulfraed Dennis Lee Bieber AF6VN
wlf...@ix.netcom.com

Robert Heller

unread,
May 23, 2019, 1:37:58 AM5/23/19
to beagl...@googlegroups.com, beagl...@googlegroups.com, Robert Heller
It also begs the question: why is root access needed, *exactly*. If you are
using GPIO, you just need to be in the GPIO group.


--
Robert Heller -- 978-544-6933
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services

Message has been deleted

Destroy

unread,
May 23, 2019, 2:19:59 AM5/23/19
to BeagleBoard

Il giorno giovedì 23 maggio 2019 07:37:58 UTC+2, Robert Heller ha scritto:
At Thu, 23 May 2019 00:58:44 -0400 beagl...@googlegroups.com wrote:

>
> On Wed, 22 May 2019 14:11:39 -0700 (PDT), "Mark A. Yoder"
> <mark....@gmail.com> declaimed the
> following:
>
> >If you run
> >
> >*sudo visudo*
> >
> >The add the following to the end.
> >
> >debian ALL=(ALL) NOPASSWD: /path/to/command/to/start.sh
> >
> >
> >you can use *sudo* without giving a password.  I think then your ExecStart
> >can be
> >
> >ExecStart=sudo /usr/bin/scriptname.s
> >
>
>         Why does all this seem to be a potential security leak? <G>
>
>         What is wrong with adding an entry in root's crontab using the @reboot
> specification for when to run the job?
>
>         A Raspberry-Pi example, but should carry over to Beaglebone just as
> well.
> https://www.raspberrypi-spy.co.uk/2013/07/running-a-python-script-at-boot-using-cron/

It also begs the question: why is root access needed, *exactly*.  If you are
using GPIO, you just need to be in the GPIO group.


--
Robert Heller             -- 978-544-6933
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
hel...@deepsoft.com       -- Webhosting Services
   

Thanks to all of the answers. 
Yes I have to work on the GPIOs, but I'm a newbie on linux and beaglebone, could you explain me how to do join GPIO group?
Thank you.
 

Robert Heller

unread,
May 23, 2019, 9:01:53 AM5/23/19
to beagl...@googlegroups.com, BeagleBoard, Robert Heller
At Wed, 22 May 2019 23:16:22 -0700 (PDT) beagl...@googlegroups.com wrote:

>
>
>
> Thanks to all of the answers.
> Yes I have to work on the GPIOs, but I'm a newbie on linux and beaglebone,
> could you explain me how to do join GPIO group?
> Thank you.
>

You use the command line tool "usermod" (don't forget the '-a'!!):

sudo usermod -a -G gpio username

The various groups you might want to add:

gpio -- this is the group for accessing GPIO lines (/sys/class/gpio/ and
/sys/class/pwm/)
i2c -- this is the group for acccessing i2c devices (/dev/i2c-*)
spi -- this is the group for accessing SPI devices (/dev/spidev*)
dialout -- this is the group for accessing tty devices (/dev/tty*)





> Il giorno giovedì 23 maggio 2019 07:37:58 UTC+2, Robert Heller ha scritto:
> >
> > At Thu, 23 May 2019 00:58:44 -0400 beagl...@googlegroups.com <javascript:>
> > wrote:
> >
> > >
> > > On Wed, 22 May 2019 14:11:39 -0700 (PDT), "Mark A. Yoder"
> > > <mark....@gmail.com <javascript:>> declaimed the
> > > following:
> > >
> > > >If you run
> > > >
> > > >*sudo visudo*
> > > >
> > > >The add the following to the end.
> > > >
> > > >debian ALL=(ALL) NOPASSWD: /path/to/command/to/start.sh
> > > >
> > > >
> > > >you can use *sudo* without giving a password. I think then your
> > ExecStart
> > > >can be
> > > >
> > > >ExecStart=sudo /usr/bin/scriptname.s
> > > >
> > >
> > > Why does all this seem to be a potential security leak? <G>
> > >
> > > What is wrong with adding an entry in root's crontab using the
> > @reboot
> > > specification for when to run the job?
> > >
> > > A Raspberry-Pi example, but should carry over to Beaglebone just
> > as
> > > well.
> > >
> > https://www.raspberrypi-spy.co.uk/2013/07/running-a-python-script-at-boot-using-cron/
> >
> > It also begs the question: why is root access needed, *exactly*. If you
> > are
> > using GPIO, you just need to be in the GPIO group.
> >
> >
> > --
> > Robert Heller -- 978-544-6933
> > Deepwoods Software -- Custom Software Services
> > http://www.deepsoft.com/ -- Linux Administration Services
> > hel...@deepsoft.com <javascript:> -- Webhosting Services

Destroy

unread,
May 23, 2019, 9:11:13 AM5/23/19
to BeagleBoard
Work's for me.
Thank you very much for your help.
Reply all
Reply to author
Forward
0 new messages