AppArmor blocks Samba (smbd) chown in share

After boot or after systemctl restart smb Samba cannot execute chown, as shown in the log line.

Basically, when I am user2 and upload a file into /home/user1 the expected behaviour is that the file owner will be user1. However, it stays user2 since AppArmor blocks smbd from changing ownership (see log).

I found out that it works, after I disable and re-enable the AppArmor-profile. Thus, I can tell it is related to AppArmor.

Thanks for your advise, which worked! That’s what I’ve done.

  1. cp /usr/lib/systemd/system/smb.service /etc/systemd/system/

  2. Add into section [service]

ExecStartPost=/usr/sbin/aa-disable /usr/sbin/smbd
ExecStartPost=/usr/sbin/aa-enforce /usr/sbin/smbd
  1. systemctl daemon-reload

However, I would be interested in fixing the root cause!!