bin: provide su

Allows to drop privileges to "system" user from root.
This commit is contained in:
Leonid Pliushch
2023-02-22 21:49:57 +02:00
parent 5e5f33f672
commit f7755c0d4a
5 changed files with 11 additions and 1 deletions

View File

@@ -34,7 +34,7 @@ RUN busybox mkdir -p /data/data/com.termux/files && \
# Link some utilities to busybox. # Link some utilities to busybox.
# Some utilities in $PREFIX are actually a wrapper of the same binary # Some utilities in $PREFIX are actually a wrapper of the same binary
# from /system/bin. See termux-tools/build.sh#L29. # from /system/bin. See termux-tools/build.sh#L29.
RUN for tool in df mount ping ping6 top umount; do \ RUN for tool in df mount ping ping6 su top umount; do \
busybox ln -s /system/bin/busybox /system/bin/$tool; \ busybox ln -s /system/bin/busybox /system/bin/$tool; \
done done
@@ -44,6 +44,8 @@ RUN for tool in df mount ping ping6 top umount; do \
# * Rest is owned by root and has 755/644 modes. # * Rest is owned by root and has 755/644 modes.
RUN busybox chown -Rh 0:0 /system && \ RUN busybox chown -Rh 0:0 /system && \
busybox chown -Rh 1000:1000 /data/data/com.termux && \ busybox chown -Rh 1000:1000 /data/data/com.termux && \
busybox ln -s /system/etc/passwd /etc/passwd && \
busybox ln -s /system/etc/group /etc/group && \
busybox find /system -type d -exec busybox chmod 755 "{}" \; && \ busybox find /system -type d -exec busybox chmod 755 "{}" \; && \
busybox find /system -type f -executable -exec busybox chmod 755 "{}" \; && \ busybox find /system -type f -executable -exec busybox chmod 755 "{}" \; && \
busybox find /system -type f ! -executable -exec busybox chmod 644 "{}" \; && \ busybox find /system -type f ! -executable -exec busybox chmod 644 "{}" \; && \

2
system/arm/etc/group Normal file
View File

@@ -0,0 +1,2 @@
root:x:0:
system:!:1000:system

2
system/arm/etc/passwd Normal file
View File

@@ -0,0 +1,2 @@
root:x:0:0:root:/:/system/bin/sh
system:x:1000:1000:system:/data/data/com.termux/files/home:/data/data/com.termux/files/usr/bin/login

2
system/x86/etc/group Normal file
View File

@@ -0,0 +1,2 @@
root:x:0:
system:!:1000:system

2
system/x86/etc/passwd Normal file
View File

@@ -0,0 +1,2 @@
root:x:0:0:root:/:/system/bin/sh
system:x:1000:1000:system:/data/data/com.termux/files/home:/data/data/com.termux/files/usr/bin/login