hi all
I am playing imx8 maaxboard and iwave boards,
I use the below system service can auto startup chromium on maaxboard wayland with root user, but it's not safe with root user, so I need to startup with non-root user.
I tried to modify it somewhere, but not work. eg , I changed one of the lines like this :ExecStart=sudo -u myuser /usr/bin/chromium --gpu-no-context-lost --enable-gpu-rasterization --start-fullscreen --kiosk --no-first-run --incognito http://localhost:3300/rpi.html > /dev/null 2>&1 &
but not work.
any help?
my service ,you can see it's root user with --no-sandbox option :
/etc/systemd/system/chromium.service
works in root user
----
Description=launch chromium
[Service]
User=root
Environment=DISPLAY=:0
Environment=XDG_RUNTIME_DIR="/run/user/0"
Type=oneshot
ExecStart=/bin/sleep 15
ExecStart=/usr/bin/chromium --no-sandbox --disable-infobars --user-data-dir=/tmp/chromium --gpu-no-context-lost --enable-gpu-rasterization --start-fullscreen --kiosk --no-first-run --incognito http://localhost:3300/rpi.html > /dev/null 2>&1 &
[Install]
WantedBy=multi-user.target
I posted my question at here too, I think this is a wayland system service question.
Hi
I add test user to sudo permission and then use your root chromium.service,in test user: sudo systemctl start chromium
Description=launch chromium
[Service]
User=root
Environment=DISPLAY=:0
Environment=XDG_RUNTIME_DIR="/run/user/0"
Type=oneshot
ExecStart=/bin/sleep 15
ExecStart=/usr/bin/chromium --no-sandbox --disable-infobars --user-data-dir=/tmp/chromium --gpu-no-context-lost --enable-gpu-rasterization --no-first-run --incognito http://localhost:3300/rpi.html > /dev/null 2>&1 &
[Install]
WantedBy=multi-user.target
But it with --no-sandbox
hi @Zhiming_Liu
Thank you
sorry, I do not get your idea, you mean it can work with non-root user,
1. how to add sudo permission to a non-root test user?
2.what is final chromium.service ? is it like the below? Thank you.
Description=launch chromium
[Service]
User=root
Environment=DISPLAY=:0
Environment=XDG_RUNTIME_DIR="/run/user/0"
Type=oneshot
ExecStart=/bin/sleep 15
ExecStart=/usr/bin/chromium --disable-infobars --user-data-dir=/tmp/chromium --gpu-no-context-lost --enable-gpu-rasterization --no-first-run --incognito http://localhost:3300/rpi.html > /dev/null 2>&1 &
#or
ExecStart= sudo /usr/bin/chromium --disable-infobars --user-data-dir=/tmp/chromium --gpu-no-context-lost --enable-gpu-rasterization --no-first-run --incognito http://localhost:3300/rpi.html > /dev/null 2>&1 &
[Install]
WantedBy=multi-user.target
Hi
Here are my commands:
1.
useradd test
2.
passwd test
3.add test user to sudo
usermod -G sudo test
4.add below text to /etc/sudoers
%sudo ALL=(ALL:ALL) ALL
5.reboot board, and login in test user
6.My chromium.service
Description=launch chromium
[Service]
User=root
Environment=DISPLAY=:0
Environment=XDG_RUNTIME_DIR="/run/user/0"
Type=oneshot
ExecStart=/bin/sleep 15
ExecStart=/usr/bin/chromium --no-sandbox --disable-infobars --user-data-dir=/tmp/chromium --gpu-no-context-lost --enable-gpu-rasterization --no-first-run --incognito http://localhost:3300/rpi.html > /dev/null 2>&1 &
[Install]
WantedBy=multi-user.target
7. use command sudo systemctl start chromium
Thank you so much.
I mean we do not use the command:sudo systemctl start chromium
to start up chromium (it seems it still manually starts up chromium), just every time reboot or power up the board, the chromium can auto startup.
anyway I will test your command to create the sudo test-user(before I generated the test user in yocto local.conf when building image)
You can add that command to init.rc , so the chromium will auto startup every time
Thank you
there is no init.rc in systemctl services (systemd ?):
-sh-4.4# cd /
-sh-4.4# cd etc/
-sh-4.4# find . -name init.rc
-sh-4.4#
before we used init.rc or init.d (something like that), but now in systemctl service (systemd), I think we can not use it. we only can write xxxx.service to auto start a servce. anyway, let me try.
maybe I find a way. I have another service, in the service, it can call a script to start up my configs , I can put into the command :sudo systemctl start chromium
I will try it. if it works, I will reply here.
Hi
I am building chromium and will test auto start service later.
BR
Zhiming