From: Alyssa Ross <hi@alyssa.is>
To: devel@spectrum-os.org
Subject: [PATCH 1/2] host/rootfs: add root-terminal s6-sudod service
Date: Tue, 9 Dec 2025 19:24:01 +0100 [thread overview]
Message-ID: <20251209182402.872822-1-hi@alyssa.is> (raw)
This will be needed as an interim measure to allow Weston itself to be
run as non-root, without the user losing access to root entirely in
the graphical environment. Currently, only root can access this
service, so it's redundant, but we can later make the socket
accessible to Weston's user.
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
host/rootfs/file-list.mk | 3 +++
.../service/root-terminal/notification-fd | 1 +
.../service/root-terminal/notification-fd.license | 2 ++
.../run-image/service/root-terminal/run | 15 +++++++++++++++
host/rootfs/image/etc/xdg/weston/weston.ini | 4 ++--
host/rootfs/image/usr/bin/root-terminal | 5 +++++
6 files changed, 28 insertions(+), 2 deletions(-)
create mode 100644 host/rootfs/image/etc/s6-linux-init/run-image/service/root-terminal/notification-fd
create mode 100644 host/rootfs/image/etc/s6-linux-init/run-image/service/root-terminal/notification-fd.license
create mode 100755 host/rootfs/image/etc/s6-linux-init/run-image/service/root-terminal/run
create mode 100755 host/rootfs/image/usr/bin/root-terminal
diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
index 6ab78e6b..f69775d2 100644
--- a/host/rootfs/file-list.mk
+++ b/host/rootfs/file-list.mk
@@ -15,6 +15,8 @@ FILES = \
image/etc/s6-linux-init/run-image/service/getty-tty2/run \
image/etc/s6-linux-init/run-image/service/getty-tty3/run \
image/etc/s6-linux-init/run-image/service/getty-tty4/run \
+ image/etc/s6-linux-init/run-image/service/root-terminal/notification-fd \
+ image/etc/s6-linux-init/run-image/service/root-terminal/run \
image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
@@ -54,6 +56,7 @@ FILES = \
image/etc/xdg/weston/weston.ini \
image/usr/bin/assign-devices \
image/usr/bin/create-vm-dependencies \
+ image/usr/bin/root-terminal \
image/usr/bin/run-appimage \
image/usr/bin/run-flatpak \
image/usr/bin/run-vmm \
diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/root-terminal/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/root-terminal/notification-fd
new file mode 100644
index 00000000..00750edc
--- /dev/null
+++ b/host/rootfs/image/etc/s6-linux-init/run-image/service/root-terminal/notification-fd
@@ -0,0 +1 @@
+3
diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/root-terminal/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/root-terminal/notification-fd.license
new file mode 100644
index 00000000..0d3d47ca
--- /dev/null
+++ b/host/rootfs/image/etc/s6-linux-init/run-image/service/root-terminal/notification-fd.license
@@ -0,0 +1,2 @@
+SPDX-License-Identifier: CC0-1.0
+SPDX-FileCopyrightText: 2025 Alyssa Ross <hi@alyssa.is>
diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/root-terminal/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/root-terminal/run
new file mode 100755
index 00000000..67ccfb45
--- /dev/null
+++ b/host/rootfs/image/etc/s6-linux-init/run-image/service/root-terminal/run
@@ -0,0 +1,15 @@
+#!/bin/execlineb -PW
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Alyssa Ross <hi@alyssa.is>
+
+s6-ipcserver-socketbinder -a 0700 /run/root-terminal
+
+fdmove 1 3
+s6-ipcserverd -1P
+
+exec -c
+/bin/export PATH /usr/bin
+/bin/export WAYLAND_DISPLAY ""
+s6-sudod
+cd /
+weston-terminal
diff --git a/host/rootfs/image/etc/xdg/weston/weston.ini b/host/rootfs/image/etc/xdg/weston/weston.ini
index a1f630cf..a4763c6d 100644
--- a/host/rootfs/image/etc/xdg/weston/weston.ini
+++ b/host/rootfs/image/etc/xdg/weston/weston.ini
@@ -6,8 +6,8 @@ path=/etc/xdg/weston/autolaunch
[launcher]
icon=/usr/share/weston/icon_terminal.png
-displayname=Terminal
-path=/bin/weston-terminal
+displayname=Root Terminal
+path=/bin/root-terminal
[launcher]
icon=/usr/share/icons/hicolor/20x20/apps/com.system76.CosmicFiles.png
diff --git a/host/rootfs/image/usr/bin/root-terminal b/host/rootfs/image/usr/bin/root-terminal
new file mode 100755
index 00000000..4f2874d1
--- /dev/null
+++ b/host/rootfs/image/usr/bin/root-terminal
@@ -0,0 +1,5 @@
+#!/bin/execlineb -Ws0
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Alyssa Ross <hi@alyssa.is>
+
+s6-sudo -- /run/root-terminal $@
--
2.51.0
next reply other threads:[~2025-12-09 18:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-09 18:24 Alyssa Ross [this message]
2025-12-09 18:24 ` [PATCH 2/2] host/rootfs: weston: run as non-root Alyssa Ross
2025-12-09 19:45 ` Demi Marie Obenour
2025-12-09 19:50 ` Alyssa Ross
2025-12-09 19:52 ` Demi Marie Obenour
2025-12-09 19:56 ` Alyssa Ross
2025-12-10 12:39 ` Alyssa Ross
2025-12-10 12:39 ` [PATCH 1/2] host/rootfs: add root-terminal s6-sudod service Alyssa Ross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251209182402.872822-1-hi@alyssa.is \
--to=hi@alyssa.is \
--cc=devel@spectrum-os.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).