jcharby01
Posts: 6
Joined: Fri May 31, 2019 3:44 pm

Samba file sharing setup help please

Fri May 31, 2019 3:49 pm

Hi all,

I am a bit of a beginner when it comes to a raspberry pi. I am trying to set up a network connection to my raspberry pi so that I can share files from my desktop that I code to it remotely. I have successfully setup putty and a vnc viewer but the samba setup is not working

I followed this tutorial when trying to configure it: https://www.juanmtech.com/samba-file-sh ... pberry-pi/

I believe I have completed everything correctly but when I go on the network tab of file explorer on my desktop, the raspberry pi does not show up. What I am wondering is if the fact that my raspberry pi is set up on a wifi network and my desktop is a direct connection if that could be the issue like two separate networks. If more information is needed please ask. Any help would be greatly appreciated.

Andyroo
Posts: 3361
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Samba file sharing setup help please

Fri May 31, 2019 4:46 pm

A couple of things will help:

1) What operating system is the Pi and Computer runnng?
2) Can you post the config file (without the comment lines) here please?

My guess will be the version of SMB you are running. Samba will be on v1 by default and Windows on v2 :lol:
Need Pi spray - these things are breeding in my house...

hortimech
Posts: 265
Joined: Wed Apr 08, 2015 5:52 pm

Re: Samba file sharing setup help please

Fri May 31, 2019 7:53 pm

No it is probably because SMBv1 is off on Samba 4.5.x by default, you need SMBv1 for network browsing.
Is it possible to navigate to the share by its UNC ?

jcharby01
Posts: 6
Joined: Fri May 31, 2019 3:44 pm

Re: Samba file sharing setup help please

Sat Jun 01, 2019 2:12 am

Andyroo wrote:
Fri May 31, 2019 4:46 pm
A couple of things will help:

1) What operating system is the Pi and Computer runnng?
2) Can you post the config file (without the comment lines) here please?

My guess will be the version of SMB you are running. Samba will be on v1 by default and Windows on v2 :lol:
1) my desktop is on Windows 10
I ran this command on my raspberry pi
[email protected]:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 8.0 (jessie)
Release: 8.0
Codename: jessie

2) here is the sbm.conf file

[global]
netbios name = Pi
server string = The Pi File Center
workgroup = WORKGROUP

[HOMEPI]
path = /home/pi/shared
comment = Pi Shared Folder
writeable = yes
create mask=0777
directory mask=0777
public=no

hortimech wrote:
Fri May 31, 2019 7:53 pm
No it is probably because SMBv1 is off on Samba 4.5.x by default, you need SMBv1 for network browsing.
Is it possible to navigate to the share by its UNC ?
I am going to be honest, I am not sure what you mean here. I have created a shared folder at /home/pi/shared and i can navigate to this on my VNC viewer and in the terminal but Im not sure what else you could be referring to. How do i turn on SMBv1?

hortimech
Posts: 265
Joined: Wed Apr 08, 2015 5:52 pm

Re: Samba file sharing setup help please

Sat Jun 01, 2019 7:28 am

Why are you still using Raspbian Jessie ?
The cause of your problem is still SMBv1, your version of Samba uses it by default, but Windows 10 doesn't and you only get network browsing with SMBv1. It isn't used any more because it is insecure,
I would upgrade to Raspbian Stretch and get used to either navigating to the share or map it as a network drive.

Ernst
Posts: 1141
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Samba file sharing setup help please

Sat Jun 01, 2019 8:43 am

My problem is that I could show you my samba configuration but it may cause new difficulties because of what I have configured.
For this reason I will not show all the entries, except what may apply to your smbv1 problem.

Code: Select all

[global]
   server string  = Samba %v on %h
   workgroup      = WORKGROUP
   server role    = standalone
   protocol       = SMB2_10
The road to insanity is paved with static ip addresses

User avatar
thagrol
Posts: 1616
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Samba file sharing setup help please

Sat Jun 01, 2019 11:05 am

jcharby01 wrote:
Fri May 31, 2019 3:49 pm
Hi all,

I am a bit of a beginner when it comes to a raspberry pi. I am trying to set up a network connection to my raspberry pi so that I can share files from my desktop that I code to it remotely. I have successfully setup putty and a vnc viewer but the samba setup is not working

I followed this tutorial when trying to configure it: https://www.juanmtech.com/samba-file-sh ... pberry-pi/

I believe I have completed everything correctly but when I go on the network tab of file explorer on my desktop, the raspberry pi does not show up. What I am wondering is if the fact that my raspberry pi is set up on a wifi network and my desktop is a direct connection if that could be the issue like two separate networks. If more information is needed please ask. Any help would be greatly appreciated.
That tutorial isn't very comprehensive.

That said, the problem is that you're depending on network browsing. I'm going to assume that your desktop is running Windows 10.

By default, and IIRC, Windows 10 no longer uses SMB 1 so network browsing won't work whether or not the server supports it.

Instead of trying to browse the network, try entering \\server_name\share_name or just \\server_name into the address field. You might want to map the share to a drive letter for convience (open This PC then click "Map network drive").
This space unintentionally left blank.

jcharby01
Posts: 6
Joined: Fri May 31, 2019 3:44 pm

Re: Samba file sharing setup help please

Sun Jun 02, 2019 2:51 am

Update:

I took @hortimech's advice and updated my image to raspbian stretch. I didnt realise the NOOBS version i had on this sd was from 2016.

I also found this tutorial from raspberrypi.org: https://www.raspberrypi.org/documentati ... s/samba.md

Things seemed to have been working fine but I am having issues on the windows side of things now. I cant seem to access the folder from the raspberry pi.

The command line sudo mount.cifs //<my IP>/share /home/pi/windowshare -o user=jchar is returning a promt for a password. No password seems to work and I get error 13 access denied. Firstly, i am not certain of what the "username" i should be entering in for user= and I do not know what password it could be prompting me for. I have tried all different combinations that i could think of along with my raspberry pi credentials.

I also tried the command line sudo mount.cifs //<my hostname>/share /home/pi/windowshare -o user=jchar or sudo mount.cifs //<my hostname>/share /home/pi/windowshare -o guest
and also got a password prompt but hit enter w/o entering a password and got error 115 Operation now in progress.

When i was sharing the folder from my desktop, I ran into two possible issues. For this step: Click on the Security tab, as we now need to configure the same permissions
Select the same settings as the Permissions tab, adding the chosen user if necessary
Click OK
I could not do anything, three "users" showed up, SYSTEM, my gmail, and Administrators. For each of these, the various options for full control were already preselected to allowing full control so i didnt change anything. The step about using the windows 10 sharing wizard in computer management also did not work. When i navigated to shared folders/shared, and tried to right click, i did not have an option to create a new share.

That is as far as I have gotten into the tutorial b/c I dont think going any further would matter at this point if this step isnt working.

Any guidance here would be greatly appreciated. Thank you.

hortimech
Posts: 265
Joined: Wed Apr 08, 2015 5:52 pm

Re: Samba file sharing setup help please

Sun Jun 02, 2019 7:44 am

Well, the rpi Samba documentation seems to be getting better :)

The example share is this:

Code: Select all

[share]
    path = /home/pi/shared
    read only = no
    public = yes
    writable = yes
Just two problems, if you look carefully you will see that if something is not 'read only' it is writable and something that is writable is not 'read only', or to put it another way, as they both mean the same thing, you only need one of them, remove the 'writable' line.
It also has a 'public' line, this is a synonym for 'guest ok' (which is the preferred option now), this is a pointless line because the page doesn't tell you to also add 'map to guest = bad user' to the [global] section of the smb.conf , so guest access will not work.
The page also doesn't tell you how to add users to Samba, so can I advise you to read our documentation:

https://wiki.samba.org/index.php/Settin ... one_Server

jcharby01
Posts: 6
Joined: Fri May 31, 2019 3:44 pm

Re: Samba file sharing setup help please

Sun Jun 02, 2019 7:28 pm

jcharby01 wrote:
Fri May 31, 2019 3:49 pm
Hi all,

I am a bit of a beginner when it comes to a raspberry pi. I am trying to set up a network connection to my raspberry pi so that I can share files from my desktop that I code to it remotely. I have successfully setup putty and a vnc viewer but the samba setup is not working

I followed this tutorial when trying to configure it: https://www.juanmtech.com/samba-file-sh ... pberry-pi/

I believe I have completed everything correctly but when I go on the network tab of file explorer on my desktop, the raspberry pi does not show up. What I am wondering is if the fact that my raspberry pi is set up on a wifi network and my desktop is a direct connection if that could be the issue like two separate networks. If more information is needed please ask. Any help would be greatly appreciated.
So I have new issue that may be related to this. I went into my network file on windows and now I am seeing the RASPBERRYPI pc listed. The issue is that when I try to go into the computer I get this error
Capture.PNG
Capture.PNG (6.66 KiB) Viewed 678 times
Is this an issue where I need to edit the smbd.conf file correctly? I have tried a few different configurations and looked at the link you sent (although i am not too sure how to alter the demo there for my needs) along with just entering the original smbd.conf file again and I always cannor get access to the PC.

jcharby01
Posts: 6
Joined: Fri May 31, 2019 3:44 pm

Re: Samba file sharing setup help please

Sun Jun 02, 2019 8:54 pm

Okay so I tried something new. I got jumbled up with all of the samba stuff so I actually reimaged my micro sc card with raspbain stretch again, went through the process of creating the share folder. I can view RASPBERRYPI in my network folder and open it up successfully and see the share folder
1.PNG
1.PNG (26.25 KiB) Viewed 671 times
I also created a test text file and can open that file from my desktop. The issue I am having now is that I cannot create a file / add a file to that folder from my desktop. I get this popup
2.PNG
2.PNG (13.31 KiB) Viewed 671 times
Here is my smb.conf file. I kept all of the original text and just added this to the bottom this time:
[share]
path = /home/pi/shared
public = yes
writable = yes

I have writeable set to yes to I am not sure as to why I cannot edit the folder. Is this a misconception about what exactly I have been setting up or does this relate to the section of mounting the folder on my deskop to the windowshare directory I created (still referencing this tutorial btw https://www.raspberrypi.org/documentati ... s/samba.md). I still cannot successfully do that mount action because of the user name and password issue. I am 100x times farther along than I was when I started but the goal I had in mind from the beginning was to be able to create a python file on my desktop and send it to the raspberry pi through the shared folder.

User avatar
thagrol
Posts: 1616
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Samba file sharing setup help please

Sun Jun 02, 2019 11:26 pm

Could be a permissions issue on the Pi.

For samba clients (e.g. your windows desktop PC) to be able to write to a share the share has to be writeable and permissions on the underlying files and directory must allow writing. Samba cannot give clients permissions that are not granted by the host OS.

As you're using guest access, samba won't be using the pi user to read/write files on the server so unless you've explictly granted write acess to group and other users samba won't be able to write to /home/pi/shared or to files and directories below it.

The quick fix is to open a terminal windows on the pi and run

Code: Select all

chmod -R a+rwx /home/pi/shared
However this is very insecure as anyone on your network as well as any local user on the pi will be able to read, write, and delete shared files.
This space unintentionally left blank.

jcharby01
Posts: 6
Joined: Fri May 31, 2019 3:44 pm

Re: Samba file sharing setup help please

Mon Jun 03, 2019 1:18 am

thagrol wrote:
Sun Jun 02, 2019 11:26 pm
Could be a permissions issue on the Pi.

For samba clients (e.g. your windows desktop PC) to be able to write to a share the share has to be writeable and permissions on the underlying files and directory must allow writing. Samba cannot give clients permissions that are not granted by the host OS.

As you're using guest access, samba won't be using the pi user to read/write files on the server so unless you've explictly granted write acess to group and other users samba won't be able to write to /home/pi/shared or to files and directories below it.

The quick fix is to open a terminal windows on the pi and run

Code: Select all

chmod -R a+rwx /home/pi/shared
However this is very insecure as anyone on your network as well as any local user on the pi will be able to read, write, and delete shared files.
Awesome this worked perfectly, thank you for the post I appreciate the help greatly. I do not need to worry about permissions too much because I am the only one on this network that should ever be using that folder in the first place. but is there a method you could link me to or explain about how to create a user and make it so only that user can view/edit the folder?

Also, If you know anything about the issue I am having with the command line sudo mount.cifs //<my IP>/share /home/pi/windowshare -o user=jchar, some insight would be great. (see one of the previous posts for more info)

User avatar
thagrol
Posts: 1616
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Samba file sharing setup help please

Mon Jun 03, 2019 1:00 pm

jcharby01 wrote:
Mon Jun 03, 2019 1:18 am
Awesome this worked perfectly, thank you for the post I appreciate the help greatly. I do not need to worry about permissions too much because I am the only one on this network that should ever be using that folder in the first place. but is there a method you could link me to or explain about how to create a user and make it so only that user can view/edit the folder?
Fristly, " I am the only one on this network that should ever be using that folder in the first place" is not a safe assumption. With your current setup anyone on your network can browse, read, and write to the share whether they should be or not.

To make this more secure, I'd suggest doing the following:
  1. Add a samba user giving it the same password as the linux user. In your case you'll want a pi user:

    Code: Select all

    sudo smbpasswd -a pi
    If you give the samba user a different password you may find that the linux one is updated to match.
  2. Change your share definition to

    Code: Select all

    [share]
        path = /home/pi/shared
        read only = no
        public = no
        writable = yes
        valid users = pi
    
    If you don't want the share to appear in the network browser add

    Code: Select all

        browseable = no
    To explain:
    "public = no" denies guest access
    "valid users = pi" allows only the pi samba user to connect to the share.
  3. Restart samba

    Code: Select all

    sudo systemctl restart smbd nmbd
  4. Reconnect from windows. You may get two login dialogue boxes, the first without a username field. This is to be expected as windows will first try with the ID of its current user.
  5. Optional: On the Pi tidy up the filesystem as permissions are now too loose and files that were created from windows will have the wrong owner:

    Code: Select all

    sudo chown -R pi:pi /home/pi/shared
    sudo chmod -R 755 /home/pi/shared
Also, If you know anything about the issue I am having with the command line sudo mount.cifs //<my IP>/share /home/pi/windowshare -o user=jchar, some insight would be great. (see one of the previous posts for more info)
Sorry, can't help with that as I don't use samba in that direction.
This space unintentionally left blank.

dunbrokin
Posts: 22
Joined: Sat Jan 05, 2019 3:16 am

Re: Samba file sharing setup help please

Thu Jun 27, 2019 9:55 pm

I have Ubuntu 19.04 on my PC and I have authorised the Public folder. I can see the Public folder from my Pi. However, no matter what I do, I cannot seem to get DejaDup Backup to transfer files from my Pi to my PC. What is the best way to transfer?

User avatar
thagrol
Posts: 1616
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Samba file sharing setup help please

Fri Jun 28, 2019 10:16 am

dunbrokin wrote:
Thu Jun 27, 2019 9:55 pm
I have Ubuntu 19.04 on my PC and I have authorised the Public folder. I can see the Public folder from my Pi. However, no matter what I do, I cannot seem to get DejaDup Backup to transfer files from my Pi to my PC. What is the best way to transfer?
Without a lot more information no one can even begin to help.

For example:
  • What errors are you getting?
  • What is in your smb.conf
  • What are the ownership and permissions on the shared storage when viewd directly on the server (i.e. when logged in to the server not when logged in to the Pi)?
  • If you're not using guest access, have you created apropriate linux and samba users?
Edit:
I forgot one: details of how you'remounting teh shared storage on the pi.
Last edited by thagrol on Fri Jun 28, 2019 12:15 pm, edited 1 time in total.
This space unintentionally left blank.

hippy
Posts: 5365
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Samba file sharing setup help please

Fri Jun 28, 2019 12:00 pm

jcharby01 wrote:
Sun Jun 02, 2019 7:28 pm
So I have new issue that may be related to this. I went into my network file on windows and now I am seeing the RASPBERRYPI pc listed. The issue is that when I try to go into the computer I get this error Capture.PNG
Same here. I have never figured it out but have never really tried to; I just map a Windows drive to the Pi's IP address and that works for me.

dunbrokin
Posts: 22
Joined: Sat Jan 05, 2019 3:16 am

Re: Samba file sharing setup help please

Sat Jun 29, 2019 5:43 am

thagrol wrote:
Fri Jun 28, 2019 10:16 am
dunbrokin wrote:
Thu Jun 27, 2019 9:55 pm
I have Ubuntu 19.04 on my PC and I have authorised the Public folder. I can see the Public folder from my Pi. However, no matter what I do, I cannot seem to get DejaDup Backup to transfer files from my Pi to my PC. What is the best way to transfer?
Without a lot more information no one can even begin to help.

For example:
  • What errors are you getting?
  • What is in your smb.conf
  • What are the ownership and permissions on the shared storage when viewd directly on the server (i.e. when logged in to the server not when logged in to the Pi)?
  • If you're not using guest access, have you created apropriate linux and samba users?
Edit:
I forgot one: details of how you'remounting teh shared storage on the pi.
Thank you for your list of missing information....I have attempted to put it all together in the hope that the problem can now be solved

What errors are you getting?
Permissioning errors and failure to mount windows share errors

What is in your smb.conf

This is the smb.conf on the Pi. (not sure if you meant the one on the PC or the Pi)


#======================= Global Settings =======================

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = WORKGROUP

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
wins support = yes

# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
; wins server = w.x.y.z

# This will prevent nmbd to search for NetBIOS names through DNS.
dns proxy = no
force user = pj

#### Networking ####

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
; interfaces = 127.0.0.0/8 eth0

# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself. However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
; bind interfaces only = yes



#### Debugging/Accounting ####

# This tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m

# Cap the size of the individual log files (in KiB).
max log size = 1000

# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
# syslog only = no

# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
syslog = 0

# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d


####### Authentication #######

# Server role. Defines in which mode Samba will operate. Possible
# values are "standalone server", "member server", "classic primary
# domain controller", "classic backup domain controller", "active
# directory domain controller".
#
# Most people will want "standalone sever" or "member server".
# Running as "active directory domain controller" will require first
# running "samba-tool domain provision" to wipe databases and create a
# new domain.
server role = standalone server

# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
passdb backend = tdbsam

obey pam restrictions = yes

# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
unix password sync = yes

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<[email protected]> for
# sending the correct chat script for the passwd program in Debian Sarge).
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
pam password change = yes

# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
map to guest = bad user

########## Domains ###########

#
# The following settings only takes effect if 'server role = primary
# classic domain controller', 'server role = backup domain controller'
# or 'domain logons' is set
#

# It specifies the location of the user's
# profile directory from the client point of view) The following
# required a [profiles] share to be setup on the samba server (see
# below)
; logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user's home directory
# (this is Samba's default)
# logon path = \\%N\%U\profile

# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
; logon drive = H:
# logon home = \\%N\%U

# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
; logon script = logon.cmd

# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe. The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u

# This allows machine accounts to be created on the domain controller via the
# SAMR RPC pipe.
# The following assumes a "machines" group exists on the system
; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u

# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.
; add group script = /usr/sbin/addgroup --force-badname %g

############ Misc ############

# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
; include = /home/samba/etc/smb.conf.%m

# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
; idmap uid = 10000-20000
; idmap gid = 10000-20000
; template shell = /bin/bash

# Setup usershare options to enable non-root users to share folders
# with the net usershare command.

# Maximum number of usershare. 0 (default) means that usershare is disabled.
; usershare max shares = 100

# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
usershare allow guests = yes

#======================= Share Definitions =======================

[homes]
comment = Home Directories
browseable = no

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
read only = yes

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
create mask = 0700

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
directory mask = 0700

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# The following parameter makes sure that only "username" can connect
# to \\server\username
# This might need tweaking when using external authentication schemes
valid users = %S

# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; read only = yes

[pihome]
comment= Pi Home
path=smb://pj-selgbuild.local:445/
browseable=Yes
writeable=Yes
only guest=no
create mask=0777
directory mask=0777
public=no

# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
; comment = Users profiles
; path = /home/samba/profiles
; guest ok =
; browseable = no
; create mask = 0600
; directory mask = 0700

[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
; write list = root, @lpadmin



What are the ownership and permissions on the shared storage when viewd directly on the server (i.e. when logged in to the server not when logged in to the Pi)?
All can create and delete files on the public folder

[*]If you're not using guest access, have you created apropriate linux and samba users?[/list]
I am not sure I understand this question.

I forgot one: details of how you'remounting teh shared storage on the pi.
I am not sure what you mean by this. But on the Pi when I click Go/Networks in the FIle Manager I can see the PC Public folder and access it directly I can also see a WINDOWS NETWORK but it does not contain any folder.

hortimech
Posts: 265
Joined: Wed Apr 08, 2015 5:52 pm

Re: Samba file sharing setup help please

Sat Jun 29, 2019 7:58 am

No, this is your actual smb.conf:

Code: Select all

[global]
wins support = yes
dns proxy = no
force user = pj
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
server role = standalone server
obey pam restrictions = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes

[homes]
comment = Home Directories
browseable = no
create mask = 0700
directory mask = 0700
valid users = %S

[pihome]
comment= Pi Home
path=smb://pj-selgbuild.local:445/
read only = no
create mask=0777
directory mask=0777

[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
create mask = 0700

[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
Just a few questions:

You have 'force user = pj' in [global], so why set the permissions to '0777' in [pihome] ?

What is this 'path=smb://pj-selgbuild.local:445/' ? I would have expected something like 'path = /home/pi', but then this would be covered by the [homes] share if you connect as the user 'pi'

As for the questions the guy asked, here they are in a different way:

What does 'ls -la /path/to/share' produce

Have you created any users on the rpi that you wish to connect to the share and also made them Samba users with 'smbpasswd -a username' (run as root)

It sounds like you are not mounting the shares anywhere, so you will need to navigate to them because SMBv1 is now turned off by default.

User avatar
thagrol
Posts: 1616
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Samba file sharing setup help please

Sat Jun 29, 2019 10:32 am

dunbrokin wrote:
Sat Jun 29, 2019 5:43 am

This is the smb.conf on the Pi. (not sure if you meant the one on the PC or the Pi)
I meant the smb.conf on the server you're having trouble connecting to. At a guess that's the one on your PC not the one on your Pi.

It'd be easy to distinguish from the rest of your post if you wrap it in code tags too.
This space unintentionally left blank.

User avatar
thagrol
Posts: 1616
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Samba file sharing setup help please

Sat Jun 29, 2019 10:57 am

hortimech wrote:
Sat Jun 29, 2019 7:58 am

What is this 'path=smb://pj-selgbuild.local:445/' ? I would have expected something like 'path = /home/pi', but then this would be covered by the [homes] share if you connect as the user 'pi'
That's a bizarre thing to be doing. Re sharing an existing samba share that's already being shared from a different server. The only time you might actually want to do this is when you want to expose the share to clients on a different subnet to the one the server is on.

As it is, you've go to go through two samba servers to get to the data which means two sets of permissions and users to configure and maintain.
As for the questions the guy asked, here they are in a different way:

What does 'ls -la /path/to/share' produce
I do have a name :)

Not quite.

In a shell prompt on the server you can't connect to what is the output of

Code: Select all

ls -al /path/to/share
replace "/path/to/share" with the local path to the shared storage (i.i the same path you have entered into smb.conf).
Have you created any users on the rpi that you wish to connect to the share and also made them Samba users with 'smbpasswd -a username' (run as root)
Nope. Have you created matching samba and linux users on the server for the user you're attmpting to connect as from the Pi?
It sounds like you are not mounting the shares anywhere, so you will need to navigate to them because SMBv1 is now turned off by default.
Sorry, nope again.

dunbrokin is using the GUI file manager so a mount will be occuring in the background. It'll be using the username of the Pi's current desktop user.

If that connection is succeeding, it's likely that the server is allowing guest access (i.e. no prompt for password and ignoring the actual username supplied).

Guest access usually maps to the linux user "nobody" so check that permissions on the shared storage and its contents allow rwx for all users.

Other than that, it could be a problem with DejaDup Backup, a programm I am not familiar with.

One last thing. Which machine is running the backup program? The Pi or your Ubuntu PC? It makes a difference as it affects which machine's config is the problem.

I have been assuming it's running on the Pi and connecting to the PC.
This space unintentionally left blank.

hortimech
Posts: 265
Joined: Wed Apr 08, 2015 5:52 pm

Re: Samba file sharing setup help please

Sat Jun 29, 2019 12:54 pm

thagrol wrote:
Sat Jun 29, 2019 10:57 am
hortimech wrote:
Sat Jun 29, 2019 7:58 am

What is this 'path=smb://pj-selgbuild.local:445/' ? I would have expected something like 'path = /home/pi', but then this would be covered by the [homes] share if you connect as the user 'pi'
That's a bizarre thing to be doing. Re sharing an existing samba share that's already being shared from a different server. The only time you might actually want to do this is when you want to expose the share to clients on a different subnet to the one the server is on.

As it is, you've go to go through two samba servers to get to the data which means two sets of permissions and users to configure and maintain.

And it wouldn't work.
As for the questions the guy asked, here they are in a different way:

What does 'ls -la /path/to/share' produce
I do have a name :)
Sorry, yes I should have referred to you by name.
Not quite.

In a shell prompt on the server you can't connect to what is the output of

Code: Select all

ls -al /path/to/share
replace "/path/to/share" with the local path to the shared storage (i.i the same path you have entered into smb.conf).
That is basically what I posted.
Have you created any users on the rpi that you wish to connect to the share and also made them Samba users with 'smbpasswd -a username' (run as root)
Nope. Have you created matching samba and linux users on the server for the user you're attmpting to connect as from the Pi?
They need to exist on both computers
It sounds like you are not mounting the shares anywhere, so you will need to navigate to them because SMBv1 is now turned off by default.
Sorry, nope again.

dunbrokin is using the GUI file manager so a mount will be occuring in the background. It'll be using the username of the Pi's current desktop user.

If that connection is succeeding, it's likely that the server is allowing guest access (i.e. no prompt for password and ignoring the actual username supplied).
Not necessarily, it might be just connecting to the share and not mounting it
Guest access usually maps to the linux user "nobody" so check that permissions on the shared storage and its contents allow rwx for all users.
He is forcing the user to be 'pj' and isn't allowing guest access.

User avatar
thagrol
Posts: 1616
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Samba file sharing setup help please

Sat Jun 29, 2019 3:50 pm

hortimech wrote:
Sat Jun 29, 2019 12:54 pm
Not quite.

In a shell prompt on the server you can't connect to what is the output of

Code: Select all

ls -al /path/to/share
replace "/path/to/share" with the local path to the shared storage (i.i the same path you have entered into smb.conf).
That is basically what I posted.
Again, not quite. Last time around neither of us specified which box the command neeed to be performed on.
Have you created any users on the rpi that you wish to connect to the share and also made them Samba users with 'smbpasswd -a username' (run as root)
Nope. Have you created matching samba and linux users on the server for the user you're attmpting to connect as from the Pi?
They need to exist on both computers
Really? That hasn't been my experience but this isn't something I've done recently. The server will use whatever user name it's been given by the client and map that to a local user name on the server. You might not see a user or group name displayed by ls if the user and group lists don't match but it should still function.

The username passed to the samba server does not have to match the username of the user currently logged in to the client. It often does but is not requied to.

And what about guest access? WIndows clients don't have the "nobody" user. Servers may not have the client's username but things still work.
It sounds like you are not mounting the shares anywhere, so you will need to navigate to them because SMBv1 is now turned off by default.
Sorry, nope again.

dunbrokin is using the GUI file manager so a mount will be occuring in the background. It'll be using the username of the Pi's current desktop user.

If that connection is succeeding, it's likely that the server is allowing guest access (i.e. no prompt for password and ignoring the actual username supplied).
Not necessarily, it might be just connecting to the share and not mounting it
Possibly, but if so the samba client is behaving very differently to most other linux filesystems. And, again, in my experience this can't be done in the shell.
Guest access usually maps to the linux user "nobody" so check that permissions on the shared storage and its contents allow rwx for all users.
He is forcing the user to be 'pj' and isn't allowing guest access.
On the Pi, yes. That's the only smb.conf dunbrokin has posted. We don't know what he is doing on the PC server. Given he's talking about a "public" share/directory I'd guess that it's "guest ok", and "read only = yes". But that's subject to the actual permission set on the files and directopries.

And I still have some doubts ovver which machine is acting as a server and which as the client. I'm still waiting for clarification on that from dunbrokin.
This space unintentionally left blank.

dunbrokin
Posts: 22
Joined: Sat Jan 05, 2019 3:16 am

Re: Samba file sharing setup help please

Sun Jun 30, 2019 5:27 am

First let me aplogise to you both for my lack of knowledge on samba....I am truly a noob when it comes to this...your patience and help is very much appreciated. I hope to learn a lot from you both. I have a PC called pj-selgbuild and 2 Pi's. One pi is called PiHole and one called PiWeather. Originally I set up the PC to act as the server and send Thunderbird information to the PiHole using DejaDup - that worked very well. It trasferred the information from my PC to a USB on PiHole. Then I found a different way of saving the TB information on the cloud using the PC. So no further need to transfer data from the PC to the PiHole. Then I decided I needed to transfer my back up weather data from PiWeather to my PC for saving in the cloud. I followed the same steps (I thought) in setting up the PiWeather as a server transferring the weathr data to the Public Folder on the PC, but I cannot get it to work. This is all background information and where I am up to at the moment.
hortimech wrote:
Sat Jun 29, 2019 7:58 am
No, this is your actual smb.conf:

Code: Select all

[global]
wins support = yes
dns proxy = no
force user = pj
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
server role = standalone server
obey pam restrictions = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes

[homes]
comment = Home Directories
browseable = no
create mask = 0700
directory mask = 0700
valid users = %S

[pihome]
comment= Pi Home
path=smb://pj-selgbuild.local:445/
read only = no
create mask=0777
directory mask=0777

[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
create mask = 0700

[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
OK, but why is this not the same as the smb.conf file that I copied and pasted from the PiWeather?? Where did this come from??

Just a few questions:
You have 'force user = pj' in [global], so why set the permissions to '0777' in [pihome] ?
Not sure I even understand your question, sorry. I could not get the PiWeather to connect to the PC becuase of permission errors and in Googling the problem, this was suggested as an answer....pj being the group name on the PC
What is this 'path=smb://pj-selgbuild.local:445/' ? I would have expected something like 'path = /home/pi', but then this would be covered by the [homes] share if you connect as the user 'pi'
Again I was following a suggestion from a Google search that seemed a reasonable solution to me as I am not familiar and knowledgeable about samba.
As for the questions the guy asked, here they are in a different way:

What does 'ls -la /path/to/share' produce
Blush! Same answer as before.
Have you created any users on the rpi that you wish to connect to the share and also made them Samba users with 'smbpasswd -a username' (run as root)
Erm, I am not sure....I may have done when I was transferring the TB data from the PC to the PiHole
It sounds like you are not mounting the shares anywhere, so you will need to navigate to them because SMBv1 is now turned off by default.
Sorry, do not have the knowledge base to understand that statement or what to do about it.

dunbrokin
Posts: 22
Joined: Sat Jan 05, 2019 3:16 am

Re: Samba file sharing setup help please

Sun Jun 30, 2019 5:30 am

thagrol wrote:
Sat Jun 29, 2019 10:32 am
dunbrokin wrote:
Sat Jun 29, 2019 5:43 am

This is the smb.conf on the Pi. (not sure if you meant the one on the PC or the Pi)
I meant the smb.conf on the server you're having trouble connecting to. At a guess that's the one on your PC not the one on your Pi.
The one I posted was the one from the Pi (which I assume is the server as it is transferring information to the PC)

Return to “Troubleshooting”