How to Ensure SELinux Properly Updates Contexts for Files Moved into a Public Share?

0
16
Asked By TechSavvyPenguin37 On

I'm having issues with SELinux not applying the correct file context for folders that I "cut" and move into a public share. The SMB share works great when I create files and folders directly within it, but when I cut folders from another location to paste into the share, I consistently have to use the 'restorecon' command to update their context. I have a file context rule set up with 'semanage fcontext -a -t samba_share_t "/media/share(/.*)?"'. Is there a way to stop this manual relabeling or to have the file contexts automatically update when I move files?

2 Answers

Answered By FileMaster2000 On

When you cut and move files, the SELinux context doesn’t automatically update to match the new location, which is by design. Instead, if you copy the files into the share, they will inherit the correct context. You might want to try using the command line and the 'cp' command instead of 'mv' to see if that makes a difference for you.

Answered By FileNinja42 On

Just to add, when you’re moving files through something like the Dolphin file manager, it might be causing additional troubles. If you want to ensure everything works smoothly, give the command line a shot—use 'cp' to copy files over, and it should take care of the context issues automatically.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.