Resolving File Permission Mismatch Between Home Assistant OS and Linux Mint

I recently encountered an issue with file permissions when mounting my Home Assistant OS filesystem on my Linux Mint machine. The files were being created with 644 permissions on the Home Assistant OS shell, but they appeared as 755 on my Linux Mint machine. This discrepancy was causing some inconvenience, especially with the executable flag, which made it annoying to open text files in my desktop environment. :face_with_raised_eyebrow:

After some research and experimentation, I found a solution that resolved the issue. Here’s how I fixed it:

  1. Adjusting Samba Configuration: I modified the Samba configuration file (/etc/samba/smb.conf) to ensure that file permissions were handled correctly during the mount process. Specifically, I added the following settings to the [global] section:

ini
force create mode = 0644
force directory mode = 0755

  1. Mounting with Proper Permissions: I updated my mount command to include the exec option, which ensures that the correct permissions are applied during the mounting process. Here’s the command I used:

bash
mount -t cifs -o username=pi,password=your_password,exec,rw,noperm //<IP_ADDRESS>/config /mnt/hass_config

  1. Testing the Changes: After making these adjustments, I remounted the filesystem and checked the permissions of new files created in Home Assistant OS. They now correctly appear as 644 on both systems, without the executable flag causing any issues. :tada:

This fix has made my workflow much smoother, and I no longer have to deal with the executable flag issue when working with files across both systems. If anyone else is experiencing similar problems, I hope this solution helps! :+1: