TransWikia.com

How to arrange a non admin command as a systemd service?

Server Fault Asked on February 3, 2021

For example, I want to run minikube start.

First I created the following minikube.service file:

[Unit]
Description=Runs minikube on startup
After=vboxautostart-service.service vboxballoonctrl-service.service vboxdrv.service vboxweb-service.service

[Service]
Type=forking
ExecStart=/usr/local/bin/minikube start

[Install]
WantedBy=multi-user.target

Then I enabled it and on the next reboot the systemd framework attempted to run it. However, it failed because apparently the minikube start command is not supposed to run as root:

The "virtualbox" driver should not be used with root privileges.

How can I run it under a non admin user?

One Answer

You can define which user have to be used bu the service. For example:

[Unit]
...

[Service]
Type=forking
ExecStart=/usr/local/bin/minikube start
User=user1
Group=group1

...

Answered by kofemann on February 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP