0

last weekend I finally bought a RPi to use it as a media server/player with RaspMBC. Since nearly 4 days now, I try to figure out how to configure the samba server properly in order to fit my needs, but I couldn't get it done. I have to say that I'm really new to the linux world, and I'm unsure if it's even possible what I want to do.

At first, here's what I'm trying to do:

  • Create an user "media", "movies" and "music" for use with samba
  • These users should only see certain shares, so "media" will see Music and Movie shares, "music" only Music share and so on. Furthermore, they should be able to login without a password and only should have read access.
  • Finally, I want to have an additional user (or use "pi") which should see every share and have full access (read/write) to them.

This is what I have done so far via ssh:

  • Create user on system: sudo useradd --no-create-home --shell /bin/false media
  • Add user to samba without entering a password: sudo smbpasswd -a media

And finally, here's my smb.conf:

[global]
 workgroup = WORKGROUP
 security=user
 encrypt passwords = yes
 follow symlinks = yes
 wide links = no
 unix extensions = yes
 lock directory = /var/cache/samba
[pi]
 browsable = yes
 read only = no
 valid users = pi
 path = /home/pi
 hide unreadable = yes
[devices]
 browsable = yes
 read only = no
 valid users = pi
 path = /media
 hide unreadable = yes
[Musik]
 browsable = yes
 read only = yes
 valid users = pi media
 write list = pi
 read list = media
 path = /media/INTENSO_MEDIA/Musik
[Filme]
 browsable = yes
 read only = yes
 valid users = pi media
 write list = pi
 read list = media
 path = /media/INTENSO_MOVIES/Filme

I tested it on my Mac. I am able to login as "media" without a password, however I can see every share, not only "Musik" and "Filme". But when I want to access "Musik" or "Filme", I'm getting this error: "The operation cannot be completed because the original item cannot be found". Nevertheless, logging in with "pi" works as expected.

So what am I missing here? Is it even possible to do what I want?

Kind regards, marank

EDIT: I forgot to say that "Musik" and "Filme" are folders on an external NTFS-formatted harddrive!

asked Jun 7, 2014 at 13:00
4
  • Why when you created the media user did you use sudo useradd --no-create-home --shell /bin/false media? This would likely cause problems, as a users config files are often stored in the home directory, and the default shell being overridden doesn't help. If you use the default shell and allow the creation of a home directory, it will likely work much better. Also, you may need an entry of media's user in smb.conf - help on configuring it can be found here. Commented Jun 7, 2014 at 13:20
  • I deleted the existing "media" user and recreated it with creating the home direction, but it seems to not change anything. What do you mean by "need an entry of media's user in smb.conf"? Sorry for being noobish. Commented Jun 7, 2014 at 13:42
  • I'm not sure (don't use samba), but there is an entry for pi in the smb.conf. If you duplicate that, but with media instead of pi as the config (e.g. here), it might work. Commented Jun 7, 2014 at 16:50
  • [pi] is only the name of the share. It has nothing to do with the username "pi". Commented Jun 7, 2014 at 19:10

1 Answer 1

1

Verify that the new users you are creating have access to the files/directories within the filesystem itself in addition to having access described in your smb.conf.

"When client users access a Samba share, they have to pass two levels of restriction. Unix permissions on files and directories apply as usual, and configuration parameters specified in the Samba configuration file apply as well. In other words, a client must first pass Samba's security mechanisms (e.g., authenticating with a valid username and password, passing the check for the valid users parameter and the read only parameter, etc.), as well as the normal Unix file and directory permissions of its Unix-side user, before it can gain read/write access to a share." - taken from Samba.org

answered Jun 8, 2014 at 20:48

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.