Page 1 of 1
smb.conf resetting after services restart?
Posted: 18 Mar 2021, 19:02
by matt_30
Hi,
I am trying to add a line into smb.conf however whenever i restart samba services the smb.conf file appears to revert itself.
Is there any way to disable this behaviour?
Re: smb.conf resetting after services restart?
Posted: 18 Mar 2021, 21:28
by DiscoSi
smb.conf is created on service start as you've found. It does include at the top another file which I believe remains static
Try adding your line to this file and see if that works. The only danger is that the rest of the smb.conf file could override your setting, or future updates will likely overwrite smb-extend.conf
Re: smb.conf resetting after services restart?
Posted: 18 Mar 2021, 23:14
by matt_30
Sadly it looks like that file is rewritted too
I added 2 coment lines in to test:
Code: Select all
[root@TNAS-7702 samba]# tail smb-extend.conf
full_audit:syslog = true
full_audit:prefix = %u|%I
full_audit:success = connect mkdir rmdir pread_send pread_recv create_file read pread write pwrite sendfile rename unlink symlink link
full_audit:failure = connect
security = user
include = /etc/samba/smb-null.conf
#
#
[root@TNAS-7702 samba]# /etc/init.d/samba restart
Reloading smb.conf file: 0
0
[root@TNAS-7702 samba]# tail smb-extend.conf
veto files = /.AppleDB/.AppleDouble/.AppleDesktop/Network Trash Folder/Temporary Items/
hide files = /~$*.doc?/~$*.xls?/~$*.ppt?
vfs objects = full_audit catia fruit streams_xattr
fruit:aapl = yes
full_audit:syslog = true
full_audit:prefix = %u|%I
full_audit:success = connect mkdir rmdir pread_send pread_recv create_file read pread write pwrite sendfile rename unlink symlink link
full_audit:failure = connect
security = user
include = /etc/samba/smb-null.conf
[root@TNAS-7702 samba]#
Re: smb.conf resetting after services restart?
Posted: 19 Mar 2021, 15:43
by RyanYang
Hi,
I'm not sure what the consequences will be if you modify the configuration file.
If you want to try to add content, maybe you can try to use "chattr -i /path" to restore the file to read-write, and then use "chattr +i /path" to lock the file as read-only after the change.