Skip to content

Instantly share code, notes, and snippets.

@belminf
Last active December 31, 2015 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save belminf/ea48d3644a4b708cdf13 to your computer and use it in GitHub Desktop.
Save belminf/ea48d3644a4b708cdf13 to your computer and use it in GitHub Desktop.
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
Copy link
Author

belminf commented Dec 31, 2015

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