1

After a fresh install of Samba I added these lines to the /etc/samba/smb.conf file:

[Media]
comment = Media Folder
path = /media
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no

And then I decided to add my "pi" account (the default account) to Samba using:

sudo smbpasswd -a pi

Everything worked, however, when connecting on windows, there were two extra folders appearing that I did not want shared. One was leading to the standard pi directory, and the other was for some printing service. I managed to disable the printing one by adding this to the .conf:

load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes

However, I cannot figure out how to disable the other "pi" directory (/home/pi) from being shared.

2 Answers 2

3

By default, samba will create a share for the user you log in as corresponding to that user's home directory. Since you're logging in as user pi, that's the "extra" share you're seeing. If you want to disable this behavior, look for a [homes] section in your /etc/samba/smb.conf and comment that entire section out by prefacing each line with '#', or just delete it. You could do the same with the [printers] section.

5
  • For some reason, doing so, prevents the device from being found by other devices. Jun 30, 2015 at 23:32
  • Doing what specifically? Be sure to only comment out the appropriate section -- the [homes] line and the indented block of lines below it.
    – bobstro
    Jul 1, 2015 at 0:34
  • I changed this: [homes] comment = Home Directories browseable = no to this: #[homes] #comment = Home Directories #browseable = no (Sorry for the lack of formatting, doesn't seem like I can do anything in the comment section) Jul 1, 2015 at 2:22
  • What is the output of `testparm'? You should see a dump that shows your service definitions. If you've made the edits properly, you should see your [Media] share, but not the [homes] section. This is really not a RPi-specific question. You might get more answers on the Unix & Linux stackexchange site.
    – bobstro
    Jul 1, 2015 at 5:19
  • I was facing the same issue as @user2005848 , there were 3 more lines which he had missed to comment out which were below #browsable = no.. which are # read only = yes # create mask = 0700 # directory mask = 0700
    – Balu
    Aug 15, 2020 at 8:30
0

Solved thing for me: I can confirm, you must comment 6 lines of "homes" section to disallow sharing /home/pi/*

#[homes]
#   comment = Home Directories
#   browseable = no
#   read only = yes
#   create mask = 0700
#   valid users = %S

and to set only one directory to share you mast insert these line

[share]
    path = /home/pi/shared
    read only = no
    public = no
    valid users = pi
    writable = yes

then add user pi

sudo smbpasswd -a pi

and restart samba

sudo systemctl restart smbd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.