What's new
  • 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!

Samba share some directories with account, some without account

I would say back to sed.
I'll be back tomorrow. Gotta wake up tomorrow morning. :eek:
Thanks you very much, in the meanwhile.
 
Since they are executed serially...

Code:
pc_replace "invalid users =" "inxalid users =" $CONFIG
pc_replace "valid users =" "# valid users =" $CONFIG
pc_replace "inxalid users =" "invalid users =" $CONFIG

Lol, you are a genious! :)
 
So, the final file would be:
Code:
#!/bin/sh

logger -t $(basename $0) $1

CONFIG=$1
source /usr/sbin/helper.sh

pc_insert "[MEDIA" "guest ok = yes" $CONFIG
pc_replace "invalid users =" "inxalid users =" $CONFIG
pc_replace "valid users =" "# valid users =" $CONFIG
pc_replace "inxalid users =" "invalid users =" $CONFIG

Where you read "MEDIA", change that to the name of the folder you want to give guest access. You need to insert only the folder name, not the whole path. And leave that "[" where it is.
Name the script "smb.postconf" and move it to /jffs/scritps. Make all scripts executable by typing:
Code:
chmod a+rx /jffs/scripts/*
Finally reboot the router.

This way everyone has read-only access to MEDIA folder.

Thanks (and copyright :D) to ColinTaylor!
 
I think on balance I prefer this method because there's only one line for "valid users" rather than three. :)
Code:
#!/bin/sh

logger -t $(basename $0) $1

CONFIG=$1
source /usr/sbin/helper.sh

sed -i 's/^valid users/#valid users/' $CONFIG
pc_insert "[MEDIA" "guest ok = yes" $CONFIG   # Repeat this line for each share you want to give guest access
 
I'd like to resurrect this topic, because I still use this configuration.
It works good with windows machines, but I'm having issues with linux.

Summary of windows behaviour:
1) With the postconf script above everyone can access as guest to the "Media" share, with read-only access. Windows doesn't show any prompt.
2) If I try to log into other shares, Windows prompts for username and passwords. Both for read and write access.
3) After I've entered the username/password in number 2, I now have write access to the "Media" share too. This is the expected behaviour.

Linux behaviour:
1) Same as windows.
2) Same as windows.
3) Here is the difference: after I've entered the username/password in number 2, I still don't have write access to the "Media" share. This is NOT the desired behaviour.

I can't find a way to make linux access to "Media" as <<username>> instead of guest. If I try to create a new file/folder in "Media", I don't get any prompt by the OS, I simply get a failure notification mentioning the share is read-only.
The only workaround I've found so far is manually entering the following address in the address bar:
Code:
smb://username@RT-N66U/Media
This way it works, but I'd like a cleaner solution.

Any advice?
Thanks.

Edit: I forgot to say that this was tested both on a Linux Mint 17 KDE installation and on an Ubuntu 14 LTS live-cd.
 

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!
Back
Top