Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Anonymous Users with User Shares

Featured Replies

I just purchased the "Plus" version to enable user shares and am very happy so far with one big exception.  Now that user shares are enabled, nobody can access any of the folders unless I have a user specifically set up for them.  Not normally a problem, but I use Media Center Extenders with my Media Center PC, and I believe they use some sort of anonymous user to access resources, so I cannot set up a user for them.

 

Here is an example of how I have a share set up...

 

Share name: movies

Comments:

Allocation method: Most-free

Split level: 1

Included disk(s);

Excluded disk(s):

Export mode: Export read-only

Exceptions:

Valid users:

Invalid users:

 

I believe this should let all users access this directory, but can I let everybody access this directory, even if I haven't explicitly set up a user in the unRAID system for them?  I would also like to set up specific directories for guests to use, but they wouldn't have user profiles set up in the unRAID system, either.

 

Is this possible, or am I just missing something easy?  Thanks.

 

Michael

AFAIK you can't do what your looking to do...I have XP MCE and vista MCE set up but have user level security enabled. 

 

If you don't have it enabled any one can view the user shares.  Now if you export read/write hidden then they would need to poke around to figure our your user shares naming structure.

 

IF you have user level security enabled then you will need to create users for each computer or have the same user name for each computer.  I chose the latter.  Also don't assign them passwords.  With XP MCE you can't save a users password (there is a long and lengthy workaround that I didn't try). 

 

So I have one user named mediacenter and the other mediaroom (both with no password)

 

My laptop has XP pro on it and under control panel > user accounts > (select account) on the right hand side is a manage my network passwords.  I added mediaroom so I didn't have to another user.

 

Now with all of my user shares the  "valid users" and "invalid users" are blank.  This allows all my users to see the shares.

 

If I only wanted to grant access to  user share "TV" to mediaroom you could add that user to valid or add all the other users to invalid.

 

Hope this helps

 

 

  • Author

That is actually quite disappointing.  :(

 

I love that I can lock down specific shares, but my personal opinion is that I've lost some functionality while gaining other functionality when turning on user level security (which was the main reason to buy the "Plus" license).

 

I tested it tonight--my media center PC can see my videos (using "My Movies" and Vista Media Center) just fine since it's logged in with a username/password, however my Media Center Extender cannot access the directory that my video files are located in since the extender does not have a username/password combination to authenticate to the unRAID server.  It works great, however, once I turned off the user level security feature, which is definitely not the preferred method.

 

Being a media server type of application, I'm surprised that unRAID behaves in this manner.  I would love to see a way in the interface to specify that a directory could be open to anonymous users--maybe a checkbox or specific username (i.e., anonymous) to be entered on the shares setup page.  Is this feature request on the laundry list anywhere?

 

For now, I guess I'll turn off the user level control and remove my personal share (which was limited to only myself) so I can use my extender, but this seems like a big waste (of both technology and money).

 

If anybody else has any ideas at all, I'd love to hear them.

 

Michael

User shares and password protection are relatively new features of unRaid having been released only a few months ago.  As with any software, version 1.0 of a feature offers a lot, but not everything folks are looking for.

 

I suggest you visit the Features Request section and pimp your needs like the rest of us.  Tom has been pretty good about adding features.

 

 

Cheers,

Bill

This is not as bleak as it may appear.

 

The mechanism that unRAID uses to implement shares (whether using user security or not) is Samba.  Samba is flexible, and will allow much finer control than what unRAID allows you to configure through its GUI.

 

I do not have user shares enabled (yet), but I wanted a share for my mp3 files so that when I do enable user security, I will not have to redo my iTunes library.  I want the share to be read only so my wife and kids don't do anything stupid to my music collection!

 

I create a share called mp3 for the /mnt/disk2/Music/mp3 directory - something not possible with unRAID configuration (unRAID always uses root directory entries for shares).  I make it read only.  I think some of the other fields are not needed for a read-only share, but I left them in anyway.  If I remember right, the "force user = root" gives the anonymous access (assuming root has no password).  The final command causes samba to reload its configuration.

 

Although I just append to the smb.shares file, you could easily create your own, hand modified, smb.shares file on your USB, copy it over the smb.shares file that unRAID creates, and reload it.  You'll just have to remember to fix it when adding new drives.  You could also do something similar to what I have done and just add your anonymous shares at the bottom of the file.  Then you will not have to be nearly as worried about changes to your unRAID configuration.

 

Here is a link to some detailed info on how to configure Samba http://us1.samba.org/samba/docs/man/Samba-HOWTO-Collection/

 

Here's the actual code (added to the bottom of my "go" script in the /config directory of the USB stick) to add this share.  Note the sleep command gives unRAID a chance to finish initializing before changing and reloading smb.shares.  Without the delay, I had some problems.

 

sleep 30
echo "[mp3]" >>/etc/samba/smb.shares
echo "path = /mnt/disk2/Music/mp3" >>/etc/samba/smb.shares
echo "read only = Yes" >>/etc/samba/smb.shares
echo "force user = root" >>/etc/samba/smb.shares
echo "map archive = Yes" >>/etc/samba/smb.shares
echo "map system = Yes" >>/etc/samba/smb.shares
echo "map hidden = Yes" >>/etc/samba/smb.shares
echo "create mask = 0711" >>/etc/samba/smb.shares
echo "directory mask = 0711" >>/etc/samba/smb.shares
smbcontrol smbd reload-config

 

(Many thanks to Joe L for helping me understand how to customize my Samba configuration.)

 

Added to the "Best of the Forums" wiki!  Make sure you check it out as it contains links to many of the most useful articles ever posted in the forums.  (Feel free to add your personal favorites as well!)  (See link in my sig)

 

Good luck!

 

Hi guys,

 

I was also bothered by the same issue so I wrote a script to enable anonymous access to specified Samba shares.

 

#!/bin/bash
#
# Title: setup_anon_shares.sh
#
# Summary:
# Use this script to enable anonymous access to pre-configured SMB shares.  The script will
# enable the guest account in your samba configuration and update smb.shares to allow
# guest access to the specified share names.
#
# DISCLAIMER:
# Your use of this script is at your sole risk. This script is provided
#  "as -is", without any warranty
#
# Further, the authors of this script shall not be liable for any damages
# you may sustain by using this information, whether direct, indirect,
# special, incidental or consequential, even if they have been advised of
# the possibility of such damages.

# Shares you wish to allow anonymous access on.  Share names must be separated by the | character,
# for example, "Video|Music" would allow anonymous access to the Video and Music shares.
sAnonShares="Video|Music"

# Configure samba guest access.  The "guest" account will be the nobody account which should already exist.
# What we're doing is telling samba to map invalid user accounts to the guest user.

# Ensure that the entries aren't duplicated
function configureSmbNames {
        egrep "^[[:space:]]*$1[[:space:]]*$" /etc/samba/smb.names >/dev/null 2>&1
        if [ $? != 0 ]
        then
                echo $1 >> /etc/samba/smb.names
        fi
}

configureSmbNames "guest account = nobody"
configureSmbNames "map to guest = bad user"

# Awk script that will insert "guest ok = yes" into the specified share configurations.
# The script will ensure that the value is not duplicated.
awk -vshares="$sAnonShares" '
BEGIN {
found = 0 
}
/^[[:space:]]*\[[[:alnum:][:space:]]+\][[:space:]]*$/ {
if (currentShare ~ shares && found == 0) {
	print "\tguest ok = yes";
}
found = 0;
currentShare = $0;
gsub(/[\[\]]/, "", currentShare);

} 
$0 ~ /^[[:space:]]*guest[[:space:]]*ok[[:space:]]*=[[:space:]]*yes[[:space:]]*$/ { 
found = 1; 
}
$0 !~ /^[[:space:]]*$/ { 
print 
} 
END {
if (currentShare ~ shares && found == 0) {
	print "\tguest ok = yes"
}
}
' /etc/samba/smb.shares > /tmp/smb.shares

# Rename the temp file and reload samba
cat /tmp/smb.shares > /etc/samba/smb.shares
rm -f /tmp/smb.shares
smbcontrol smbd reload-config

 

What the script does is modify /etc/samba/smb.names to add guest account = nobody and map to guest = bad user to the global Samba configuration.  The first option specifies that the guest account should use the "nobody" user, which unRAID appears to already create.  The second option tells Samba to map any invalid user requests to the guest account.  However, if your Windows login user name already exists on your unRAID server, you will get a password prompt because that is not a "bad user", but an invalid password. 

 

The second part of the script will modify /etc/samba/smb.shares to add the guest ok = yes parameter to the shares specified in sAnonShares

 

With regards to usage, you should add this as part of your go script.  It would probably be a good idea to add a "sleep 30" before calling the script just to allow unRAID to get itself properly setup.  You should also run this script whenever you modify your share configuration.

 

Hope this helps!

very interesting

 

I wonder why the first part of the script is not already like that in official unRAID.

 

 

  • 1 year later...

Thanks planetscott.  The script works great. 

 

I'm a big fan of keeping places I have to edit things to a minimum.  As such,

using your unmodified setup_anon_shares.sh I have the following two lines of code in my go script:

 

awk '{ gsub(/^sAnonShares=.*$/,"sAnonShares=\"media|foo|bar\""); print }' /boot/setup_anon_shares.sh > /tmp/setup_anon_shares.sh
/tmp/setup_anon_shares.sh

 

Alternatively, if you want to overwrite the original file:

{ rm /boot/setup_anon_shares.sh && awk '{ gsub(/^sAnonShares=.*$/,"sAnonShares=\"media|foo|bar\"")}1'> /boot/setup_anon_shares.sh; } < /boot/setup_anon_shares.sh
/boot/setup_anon_shares.sh

 

Another alternative, I did this first because I'm a perl guy but decided I don't want to load perl just for this.  If you already load perl this is the prettiest:

perl -pi -e 's/^sAnonShares=.*$/sAnonShares="media|foo|bar"/' /boot/setup_anon_shares.sh
/boot/setup_anon_shares.sh

 

 

  • 1 month later...
My improved version can be found attached to this post

 

As the name of the samba config files has changed in more recent versions, the original script will no longer work unless it is modified.  Also, the original version did not properly deal with share names with spaces, dashes, or underscores (anything other than alpha) and put the guest ok in the wrong spot when there were multiple shares with the same sub-string.  I have "Movies", "Movies A-D" "Movies E-J", Movies K-O", etc.  It put the "guest ok" in "Movies_New" (the first share after the one I had that did not have an embedded space)

 

My improved version automatically uses the correct samba file and it also allows you to specify the share list on the command line.  That means you do not need to edit the command at all, you can simply invoke it with the "-s" parameter.  This will simplify the lines you need to edit in the attached file, in fact, it does not need to be edited at all.  That should make it much easier for most users.

 

There was another bug in the original version I fixed.  It matched the supplied string of shares as a sub-string.  It now matches explicitly the share name, not just looking for it as a sub-string of a share name.

 

I've also added a few lines sent to the screen showing what it does when it does it when you invoke it... They will help you to know it worked as intended.  If nothing is prints, the lines it adds are already in your samba files and it does nothing.

 

The usage is:

anonymous.sh

or

anonymous.sh -s "Movies|Pictures|TV"

If you do not supply a share list using the "-s" option, it will default to "Movies|TV"

 

You can also type

anonymous.sh -v

to see the current version (I made this version 1.1)

 

Minimal usage help is available by typing:

anonymous.sh -h  or anonymous.sh -?

 

Joe L.

 

  • 7 months later...

Somehow I can't get this to run in the go script.

 

I've tried:

 

/boot/anonymous.sh

 

cd /boot/anonymous.sh

/boot/anonymouse.sh -s "Movies|Tv Series|DVD"

 

Nothing seems to be able to start the command up in the goscript. I still had to telnet and enter the command for it to work. What seems to be the problem with it?

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.