Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker.linuxserver.plex chown -R crosses file system boundaries #97

Open
heitbaum opened this issue Dec 25, 2021 · 2 comments
Open

docker.linuxserver.plex chown -R crosses file system boundaries #97

heitbaum opened this issue Dec 25, 2021 · 2 comments

Comments

@heitbaum
Copy link

The following code does a chown -R across file system boundaries. Unfortunately neither busybox chown (nor gnu chown) do have -xdev option. The -P option is the default - but doesn’t help as this stops following symbolic links but does allow crossing the file system boundary.

The code can mistakenly reset ownership (that it may not have too)

A few ideas

  • check that there are no filesystems mounted under the $i
  • create a new variable and
    • Set the default option not to do the chown
  • only set ownership of if docker.linuxserver.plex does the mkdir

for i in "$V_config" "$V_data_tvshows" "$V_data_movies" "$V_transcode" "$V_data_photos"; do
if [ ! "$(ls -nd $i | awk '{print $3}')" = "$E_PUID" ]; then
echo "attempting chown ${E_PUID}/${E_PGID} on $i"
chown -R "${E_PUID}":"${E_PGID}" "$i" 2>&1 >/dev/null
echo "chown attempt completed, moving on"
else
echo "skipping chown, make sure the folder $i is accessible by the user ${E_PUID}:${E_PGID}"
fi
done

@aptalca
Copy link
Member

aptalca commented Dec 25, 2021

Can you list some actual scenarios where this code would cause an issue?

Libreelec system is read only. This code only chowns the folders that are selected in addon settings and none of the defaults refer to any system folders. Even then, libreelec runs as root.

@heitbaum
Copy link
Author

Can you list some actual scenarios where this code would cause an issue?

Libreelec system is read only. This code only chowns the folders that are selected in addon settings and none of the defaults refer to any system folders. Even then, libreelec runs as root.

I had mistakenly put /var/media as one of the folders, whilst the exfat filesystems (most of /var/media) just errored with unable to change. My ext4 filesystem (/var/media/DATA) did not fair so well. Not real issue with it - given only a folder that neede to be changed back to 1000:1000 and lost+found.

in thinking more about it - sleep helps, and your query:

  • why do we need to do $V_data_ anyhow?
  • V_config and V_transcode - yes (but probably only chown and not chown -R)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants