Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Modify smb.conf to allow guest access to "public" share, using with asuswrt-merlin
#!/bin/sh
# Grant guess access
sed -i '/\[public\]/,/^\[/ s/invalid users.*/guest only = yes\nwritable = yes/' /etc/smb.conf
# Remove user-specific ACLs
sed -i '/\[public\]/,/\[/ {/^\(valid\|invalid\|read\|write\)/d}' /etc/smb.conf
# Kill samba processes running
for pid in $(ps -w | grep [s]mbd | awk '{ print $1 }')
do
kill $pid 2> /dev/null
done
# Restart samba with modified config
smbd -D -s /etc/smb.conf
@belminf

This comment has been minimized.

Show comment
Hide comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment