You are not logged in.

#1 2021-11-08 10:24:08

Ridwan Rawriet
Member
Registered: 2021-09-28
Posts: 33

[SOLVED] How can I run a program at startup as non root user?

I'm doing a setup to run only firefox under bare X and want it to start as soon as the system boots. I've successfully enabled auto-login for my user account following the wiki. Now to start firefox at start up, searching the web, I found a systemd method. I created a script containing:

#!/bin/bash 
startx /bin/firefox 

Then I created a systemd unit and enabled it to run the script and it does open firefox at boot but as root user. How can I do this as a normal user? Also is creating this script and then creating the unit unnecessary, meaning only putting /bin/firefox after ExecStart= in the unit will do the trick?

Last edited by Ridwan Rawriet (2022-01-28 12:03:21)

Offline

#2 2021-11-08 10:28:53

SanskritFritz
Member
From: Budapest, Hungary
Registered: 2009-01-08
Posts: 1,954
Website

Re: [SOLVED] How can I run a program at startup as non root user?

In the systemd unit:

[Service]
User=yourusername
Group=groupname_optional

The second method you could simply try.


zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)

Offline

#3 2021-11-08 10:30:15

Ridwan Rawriet
Member
Registered: 2021-09-28
Posts: 33

Re: [SOLVED] How can I run a program at startup as non root user?

Thanks, for replying to mega noob stuff. Solved!

Last edited by Ridwan Rawriet (2021-11-08 10:30:29)

Offline

#4 2021-11-08 10:50:45

SanskritFritz
Member
From: Budapest, Hungary
Registered: 2009-01-08
Posts: 1,954
Website

Re: [SOLVED] How can I run a program at startup as non root user?

Please mark this thread as [solved] as per https://wiki.archlinux.org/title/Genera … ow_to_post


zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)

Offline

#5 2021-11-08 11:43:31

adventurer
Member
Registered: 2014-05-04
Posts: 128

Re: [SOLVED] How can I run a program at startup as non root user?

Offline

#6 2021-11-08 13:16:19

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,496
Website

Re: [SOLVED] How can I run a program at startup as non root user?

Why create a script to run from a service when your .profile is already being run.  Just follow this:
https://wiki.archlinux.org/title/Start_X_at_boot


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB