Root directory and system-related files change ownership to the current user when the user changes
LeiCraft opened this issue · 0 comments
LeiCraft commented
Expected Behavior
Ownership should not change
Actual Behavior
When switching to a non-root user, the ownership of almost all files and directories changes
Steps to Reproduce the Problem
- Download and install Proot
- Run
proot -0 -rootfs "<path>" -b /dev -b /sys -b /proc
- add another user with
useradd -s /bin/bash <username>
- Run
sudo su <username>
to change User - Run
ls -l /
to see the issue
Specifications
- Proot/Care version: v5.4.0
- Kernel version: 5.10.0-29-cloud-amd64
- Host distribution: Ubuntu 24.04
- Guest distribution: Debian 11
Command Output
root@hostname:/# ls -l /
total 60
lrwxrwxrwx 1 root root 7 May 17 05:24 bin -> usr/bin
drwxr-xr-x 2 root root 4096 Jan 28 21:20 boot
drwxr-xr-x 5 root root 360 May 17 14:14 dev
drwxr-xr-x 53 root root 4096 May 17 12:27 etc
drwxr-xr-x 4 root root 4096 May 17 12:27 home
-rwxr-xr-x 1 root root 3163 May 17 12:25 install.sh
lrwxrwxrwx 1 root root 7 May 17 05:24 lib -> usr/lib
lrwxrwxrwx 1 root root 9 May 17 05:24 lib32 -> usr/lib32
lrwxrwxrwx 1 root root 9 May 17 05:24 lib64 -> usr/lib64
lrwxrwxrwx 1 root root 10 May 17 05:24 libx32 -> usr/libx32
drwxr-xr-x 2 root root 4096 May 17 05:24 media
drwxr-xr-x 2 root root 4096 May 17 05:24 mnt
drwxr-xr-x 2 root root 4096 May 17 05:24 opt
dr-xr-xr-x 166 root root 0 May 17 14:14 proc
drwx------ 2 root root 4096 May 17 15:28 root
drwxr-xr-x 3 root root 4096 May 17 14:14 run
lrwxrwxrwx 1 root root 8 May 17 05:24 sbin -> usr/sbin
drwxr-xr-x 2 root root 4096 May 17 05:24 srv
dr-xr-xr-x 13 root root 0 May 17 14:14 sys
drwxr-xr-x 2 root root 4096 May 17 12:26 tmp
drwxr-xr-x 14 root root 4096 May 17 05:24 usr
drwxr-xr-x 11 root root 4096 May 17 05:24 var
root@hostname:/# su leicraft
leicraft@hostname:/$ ls -l /
total 60
lrwxrwxrwx 1 leicraft leicraft 7 May 17 05:24 bin -> usr/bin
drwxr-xr-x 2 leicraft leicraft 4096 Jan 28 21:20 boot
drwxr-xr-x 5 root root 360 May 17 14:14 dev
drwxr-xr-x 53 leicraft leicraft 4096 May 17 12:27 etc
drwxr-xr-x 4 leicraft leicraft 4096 May 17 12:27 home
-rwxr-xr-x 1 leicraft leicraft 3163 May 17 12:25 install.sh
lrwxrwxrwx 1 leicraft leicraft 7 May 17 05:24 lib -> usr/lib
lrwxrwxrwx 1 leicraft leicraft 9 May 17 05:24 lib32 -> usr/lib32
lrwxrwxrwx 1 leicraft leicraft 9 May 17 05:24 lib64 -> usr/lib64
lrwxrwxrwx 1 leicraft leicraft 10 May 17 05:24 libx32 -> usr/libx32
drwxr-xr-x 2 leicraft leicraft 4096 May 17 05:24 media
drwxr-xr-x 2 leicraft leicraft 4096 May 17 05:24 mnt
drwxr-xr-x 2 leicraft leicraft 4096 May 17 05:24 opt
dr-xr-xr-x 168 root root 0 May 17 14:14 proc
drwx------ 2 leicraft leicraft 4096 May 17 15:28 root
drwxr-xr-x 3 leicraft leicraft 4096 May 17 14:14 run
lrwxrwxrwx 1 leicraft leicraft 8 May 17 05:24 sbin -> usr/sbin
drwxr-xr-x 2 leicraft leicraft 4096 May 17 05:24 srv
dr-xr-xr-x 13 root root 0 May 17 14:14 sys
drwxr-xr-x 2 leicraft leicraft 4096 May 17 12:26 tmp
drwxr-xr-x 14 leicraft leicraft 4096 May 17 05:24 usr
drwxr-xr-x 11 leicraft leicraft 4096 May 17 05:24 var