What's new

smb.postconf not doing anything

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

MUCK

New Around Here
I'm trying to insert some veto rules into my smb.conf file via the following smb.postconf, located at /jffs/scripts/smb.postconf:
Code:
#!/bin/sh
CONFIG=$1

sed -i '' 's:veto files = :veto files = /._*/.DS_Store/.Trashes/.TemporaryItems:g' $CONFIG

Unfortunately it doesn't appear to have any effect on the file. I've tested it locally on macOS and it works fine.

I have chmoded the file too:

Code:
chmod a+rx /jffs/scripts/smb.postconf

Is there something I'm missing? Log shows that it's being executed but it just doesn't seem to do a single thing, regardless of what arguments I pass to sed. Also worth noting I'm a bit of a unix noob so assume nothing!
 
Last edited:
I'm trying to insert some veto rules into my smb.conf file via the following smb.postconf, located at /jffs/scripts/smb.postconf:
Code:
#!/bin/sh
CONFIG=$1

sed -i '' 's:veto files = :veto files = /._*/.DS_Store/.Trashes/.TemporaryItems:g' $CONFIG

Unfortunately it doesn't appear to have any effect on the file. I've tested it locally on macOS and it works fine.

I have chmoded the file too:

Code:
chmod a+rx /jffs/scripts/smb.postconf

Is there something I'm missing? Log shows that it's being executed but it just doesn't seem to do a single thing, regardless of what arguments I pass to sed. Also worth noting I'm a bit of a unix noob so assume nothing!
The *.postconf files are there to modify an existing entry in the configuration file.
Your sed is looking for the line with "veto files" which does not exit in the standard smb.conf on Asuswrt-Merlin.

Instead, you can simply append your veto file to the smb.conf with this modification to /jffs/scripts/smb.postconf:
Code:
#!/bin/sh
CONFIG=$1
echo >> $CONFIG
echo 'veto files = /._*/.DS_Store/.Trashes/.TemporaryItems' >> $CONFIG
I've added an empty line (first echo) just to make sure the veto rule goes on a new line.

Hope it works now, have not tested it but the syntax should be correct.

BTW, to test it, run this command in the terminal, it restarts samba and reads the config file in:
Code:
service restart_nasapps
 
Your sed is looking for the line with "veto files" which does not exit in the standard smb.conf on Asuswrt-Merlin.
Are you sure? cat /etc/smb.conf produces the following:
Code:
[global]
workgroup = WORKGROUP
netbios name = BananaStorage
server string = BananaStorage
unix charset = UTF8
display charset = UTF8
load printers = no
printing = bsd
printcap name = /dev/null
log file = /var/log.samba
log level = 0
max log size = 5
auth methods = guest
guest account = admin
map to guest = Bad Password
guest ok = yes
encrypt passwords = yes
pam password change = no
null passwords = yes
force directory mode = 0777
force create mode = 0777
max connections = 5
socket options = IPTOS_LOWDELAY TCP_NODELAY SO_KEEPALIVE
obey pam restrictions = no
disable spoolss = yes
host msdfs = no
strict allocate = no
wide links = no
bind interfaces only = yes
interfaces = lo br0 192.168.1.1/255.255.255.0
use sendfile = yes
map archive = no
map hidden = no
map read only = no
map system = no
store dos attributes = yes
dos filemode = yes
oplocks = yes
level2 oplocks = yes
kernel oplocks = no
enable core files = no
deadtime = 30
load printers = no
printable = no
max protocol = SMB2
smb encrypt = disabled
min receivefile size = 16384
passdb backend = smbpasswd
smb passwd file = /etc/samba/smbpasswd
[The_Big_One]
comment = ST8000AS 0002-1NA17Z's The_Big_One
veto files = /.__*.txt*/asusware*/asus_lighttpdpasswd/
path = /tmp/mnt/The_Big_One
writeable = yes
dos filetimes = yes
fake directory create times = yes
[The_Small_1]
comment = TOSHIBA MQ01ABB200's The_Small_1
veto files = /.__*.txt*/asusware*/asus_lighttpdpasswd/
path = /tmp/mnt/The_Small_1
writeable = yes
dos filetimes = yes
fake directory create times = yes

Which most definitely does contain a veto files line (and therefore I shouldn't append it to the end). Is this right, or am I misunderstanding something?

Just curious, what is the smb.conf meant to contain (assuming a network share has been set up through the UI), and why is mine different (or appearing that way).

Thanks for your efforts, really appreciate it :)

EDIT: Thought I'd try your approach regardless and unfortunately it hasn't modified smb.conf at all...
 
Last edited:
Are you sure? cat /etc/smb.conf produces the following:
Code:
[global]
workgroup = WORKGROUP
netbios name = BananaStorage
server string = BananaStorage
unix charset = UTF8
display charset = UTF8
load printers = no
printing = bsd
printcap name = /dev/null
log file = /var/log.samba
log level = 0
max log size = 5
auth methods = guest
guest account = admin
map to guest = Bad Password
guest ok = yes
encrypt passwords = yes
pam password change = no
null passwords = yes
force directory mode = 0777
force create mode = 0777
max connections = 5
socket options = IPTOS_LOWDELAY TCP_NODELAY SO_KEEPALIVE
obey pam restrictions = no
disable spoolss = yes
host msdfs = no
strict allocate = no
wide links = no
bind interfaces only = yes
interfaces = lo br0 192.168.1.1/255.255.255.0
use sendfile = yes
map archive = no
map hidden = no
map read only = no
map system = no
store dos attributes = yes
dos filemode = yes
oplocks = yes
level2 oplocks = yes
kernel oplocks = no
enable core files = no
deadtime = 30
load printers = no
printable = no
max protocol = SMB2
smb encrypt = disabled
min receivefile size = 16384
passdb backend = smbpasswd
smb passwd file = /etc/samba/smbpasswd
[The_Big_One]
comment = ST8000AS 0002-1NA17Z's The_Big_One
veto files = /.__*.txt*/asusware*/asus_lighttpdpasswd/
path = /tmp/mnt/The_Big_One
writeable = yes
dos filetimes = yes
fake directory create times = yes
[The_Small_1]
comment = TOSHIBA MQ01ABB200's The_Small_1
veto files = /.__*.txt*/asusware*/asus_lighttpdpasswd/
path = /tmp/mnt/The_Small_1
writeable = yes
dos filetimes = yes
fake directory create times = yes

Which most definitely does contain a veto files line (and therefore I shouldn't append it to the end). Is this right, or am I misunderstanding something?

Just curious, what is the smb.conf meant to contain (assuming a network share has been set up through the UI), and why is mine different (or appearing that way).

Thanks for your efforts, really appreciate it :)

EDIT: Thought I'd try your approach regardless and unfortunately it hasn't modified smb.conf at all...
OK, standard Merlin does not have Optware installed, which you have. Let me check real quick, your sed substitution should work then.
 
OK, standard Merlin does not have Optware installed, which you have. Let me check real quick, your sed substitution should work then.
I didn't even know I had Optware installed :eek: I think something must be fundamentally wrong here because the file isn't being modified at all, even with your commands (regardless of whether they produce a correct file, they should at least be modifying it).
 
I didn't even know I had Optware installed :eek: I think something must be fundamentally wrong here because the file isn't being modified at all, even with your commands (regardless of whether they produce a correct file, they should at least be modifying it).
Maybe the file has dos line endings instead of unix, try this:
Code:
dos2unix /jffs/scripts/smb.postconf

Then for the substitution, assuming you want to replace both instances of 'veto files = /.__*.txt*/asusware*/asus_lighttpdpasswd/' with your directive:
Code:
#!/bin/sh
CONFIG=$1

sed -i 's:veto files.*:veto files = /._*/.DS_Store/.Trashes/.TemporaryItems:g' $CONFIG
This is tested so it will work.
 
Maybe the file has dos line endings instead of unix, try this:
Code:
dos2unix /jffs/scripts/smb.postconf

Then for the substitution, assuming you want to replace both instances of 'veto files = /.__*.txt*/asusware*/asus_lighttpdpasswd/' with your directive:
Code:
#!/bin/sh
CONFIG=$1

sed -i 's:veto files.*:veto files = /._*/.DS_Store/.Trashes/.TemporaryItems:g' $CONFIG
This is tested so it will work.
Thanks for all your help, thelonelycoder; it worked! :)
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Staff online

Top