As there are only a few options one can change via the Samba WUI page I began to create/modify the file /var/ipfire/samba/smb.conf.local - sorry I don’t remember where I found this possibility.
Now this file is somehow imported into the /var/ipfire/samba/smb.conf if one updates something via the Samba WUI page and also if one updates to a newer IPFire core version.
Now I want to remove the ‘recycle’ option from the ‘vfs objects’. Where do I need to change this permanantly so that it is not lost during the next core or Samba WUI page update?
I do not think you can, if it is by default in smb.conf. There is the hack way, but this can be dangerous.
You could write a script that checks the presence of recycle option, backup smb.conf and then comments out that line and restarts samba. You could call this script at reboot by usingrc.local.
The script would be something like this (please do not copy and paste; make sure you understand the script):
#!/bin/bash
# Backup the original smb.conf
cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
# Check if the recycle module is enabled
if grep -q "vfs objects = recycle" /etc/samba/smb.conf; then
# If it's enabled, comment out the line
sed -i 's/vfs objects = recycle/#&/' /etc/samba/smb.conf
fi
# Restart the Samba service
/etc/init.d/samba restart
Please keep in mind this is a horrible hack and can punish you inflicting a lot of pain. If it happens, it is NOT my responsibility. At the very least, have a backup and be prepared to reinstall IPFire and restore your backup.
The vfs objects line is actually defined in the samba.cgi file and the perl code takes all the defined lines and puts it into the configuration file. It is at line 808 in samba.cgi
Some lines later is where the content of smb.conf.local if it exists is added onto the end of smb.conf.
If you want to remove the recycle option from vfs objects you will need to edit /srv/web/ipfire/cgi-bin/samba.cgi
That should not be overwritten by updating the Samba WUI page but it could be overwritten by a Core Update where the samba package is updated or modified in some way.
Removing ‘recycle’ from /srv/web/ipfire/cgi-bin/samba.cgi did not produce any result. Now I found the file /var/ipfire/samba/global. Here I could adjust it permanently. Hope that helps someone else later, too.
When you press Save on the Samba WUI page then the samba.cgi code writes the settings in that section including the vfs objects line to the /var/ipfire/samba/global
When you removed the recycle from the samba.cgi line, did you the go to the Samba WUI page and press Save. If not then nothing will have happened. If you leave the recycle in the samba.cgi code and remove it from the global file then when you Save on the Samba WUI page it will overwrite that global file with the data in the samba.cgi code from line 780 to 813.
I haven’t tested out the above but that is what the code says it will do from my quick reading through it.
EDIT:
I have just tested it out on my vm system and confirmed my above analysis.
I removed recycle from the global file and then pressed Save on the Samba WUI page and recycle was back in the file.
I then removed recycle from the samba.cgi code and checked the global file and recycle was still there but after pressing Save on the Samba WUI page it was removed from the global file.
Thanks for all your analysis. I’ve tested the same procedure but the global file wasn’t overwritten because I only changed the order of options of one share on the Samba WUI page. So the smb.conf was new created but with the old global section. But now it makes sense, we have to press Save if we want to regenerate the global section.