mrsharpey
Posts: 6
Joined: Tue Mar 19, 2019 9:13 pm

SMB Samba Share - HELP ME PLEASE! :)

Tue Mar 19, 2019 9:22 pm

Hi all,

I've managed to setup my Pi 3 running Stretch to be an OpenVPN router, but can I get a simple fileshare to work? :D

The smbd service is installed and running, and I've configured my smb.conf file.

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

I then restarted the smbd service, but I can't see the share on my W10 PC. Either in Network or accessing the share via \\ipaddress

sudo smbstatus --shares shows no shares present either.

All out of ideas - can anyone help please?

Thanks,
Sharpey.

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

Re: SMB Samba Share - HELP ME PLEASE! :)

Wed Mar 20, 2019 2:29 am

It’s possibly the version of SMB you are running. By default Samba uses SMBv1 and Windows has removed that :roll:

Did you add a password for Pi in smbpasswd?

You could try:
1) Enable SMBv1 on the PC again
2) Configure min protocol as SMB2 - see https://www.cyberciti.biz/faq/how-to-co ... x-or-unix/
3) Create a registry DWORD value 1 at HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\AllowInsecureGuestAuth

Expect to reboot each time :lol:

If the registry fix does not work, delete the key again.

Edit: public=yes gives anyone access so making the user redundant if memory serves me (normally poorly)
Edit2: Check the workgroup name on the PC and Samba config as well.
Need Pi spray - these things are breeding in my house...

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

Re: SMB Samba Share - HELP ME PLEASE! :)

Wed Mar 20, 2019 9:12 am

Andyroo wrote:
Wed Mar 20, 2019 2:29 am
It’s possibly the version of SMB you are running. By default Samba uses SMBv1 and Windows has removed that :roll:
And if Debian was using a supported Samba version, Raspbian wouldn't be using SMBv1 either.
Andyroo wrote:
Wed Mar 20, 2019 2:29 am

You could try:
1) Enable SMBv1 on the PC again
2) Configure min protocol as SMB2 - see https://www.cyberciti.biz/faq/how-to-co ... x-or-unix/
3) Create a registry DWORD value 1 at HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\AllowInsecureGuestAuth
1) You could do this, but it is not recommended.
2) This is probably the preferred option
3) Not sure how that will help, it turns on 'Guest' on the Windows client, it wouldn't actually affect Samba.
Andyroo wrote:
Wed Mar 20, 2019 2:29 am
Expect to reboot each time :lol:
Never heard of: smbcontrol all reload-config
Andyroo wrote:
Wed Mar 20, 2019 2:29 am
Edit: public=yes gives anyone access so making the user redundant if memory serves me (normally poorly)
Edit2: Check the workgroup name on the PC and Samba config as well.
'public' is a synonym for 'guest ok', but adding either isn't going to help, because there is a 'valid user' line. The user will have been authenticated by the time it gets to the share, now this could be as a user, or, if 'map to guest = bad user' is set, it could be the guest user. The OP's share has 'valid users = pi', this means that if the user isn't 'pi', they will not be allowed access, even if guest access is allowed.

It also shouldn't matter if the pi is in a different workgroup, you should still be able to connect to it.

If you remove all the default settings, duplicates and things that are not going to work from the OP's share, you get this:

Code: Select all

[share]
path = /home/pi/shared
valid users = pi
read only = no
This will only allow the user 'pi' to access the share, but only if 'pi' has been added to Samba.

If you want authenticated user and guest access, you will need to change it to this:

Code: Select all

[share]
path = /home/pi/shared
read only = no
guest ok = yes

mrsharpey
Posts: 6
Joined: Tue Mar 19, 2019 9:13 pm

Re: SMB Samba Share - HELP ME PLEASE! :)

Wed Mar 20, 2019 3:52 pm

Thanks for the replies so far. From what I can gather the share isn't being created whatsoever.

smbstatus --shares shows nothing, so the authenticated users aren't even coming into play here...or are they?

I'll have a look in the logs to see if there's anything obvious.

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

Re: SMB Samba Share - HELP ME PLEASE! :)

Wed Mar 20, 2019 4:14 pm

mrsharpey wrote:
Wed Mar 20, 2019 3:52 pm
Thanks for the replies so far. From what I can gather the share isn't being created whatsoever.
What do you mean by <isn't being created> ?
Samba doesn't create the share folder, you have to.

mrsharpey
Posts: 6
Joined: Tue Mar 19, 2019 9:13 pm

Re: SMB Samba Share - HELP ME PLEASE! :)

Wed Mar 20, 2019 4:18 pm

I have created the folder, but it seems it's not created the share.

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

Re: SMB Samba Share - HELP ME PLEASE! :)

Wed Mar 20, 2019 4:25 pm

Ref reboot (should have been clear - PC side) :oops:

I’ve just checked a Zero next to me and the status shows no shares despite having it set up and working fine.

My share config is slightly different:

Code: Select all

[Trooper-Pi]
    path = /home/pi
    available = yes
    browsable = yes
    writeable = yes
    create mask = 0644
    directory mask = 0755
    public = no
As I thought, as soon as I brought up the Mac (on 177) and connected, the share reports as being present:

Code: Select all

Service      pid     Machine       Connected at                     Encryption   Signing     
---------------------------------------------------------------------------------------------
Trooper-Pi   21188   192.168.1.177 Wed Mar 20 16:26:21 2019 GMT     -            -  



EDITED: Added code block to above to show indentation and added share result.
Need Pi spray - these things are breeding in my house...

mrsharpey
Posts: 6
Joined: Tue Mar 19, 2019 9:13 pm

Re: SMB Samba Share - HELP ME PLEASE! :)

Wed Mar 20, 2019 7:29 pm

Andyroo wrote:
Wed Mar 20, 2019 4:25 pm
Ref reboot (should have been clear - PC side) :oops:

I’ve just checked a Zero next to me and the status shows no shares despite having it set up and working fine.

My share config is slightly different:

Code: Select all

[Trooper-Pi]
    path = /home/pi
    available = yes
    browsable = yes
    writeable = yes
    create mask = 0644
    directory mask = 0755
    public = no
As I thought, as soon as I brought up the Mac (on 177) and connected, the share reports as being present:

Code: Select all

Service      pid     Machine       Connected at                     Encryption   Signing     
---------------------------------------------------------------------------------------------
Trooper-Pi   21188   192.168.1.177 Wed Mar 20 16:26:21 2019 GMT     -            -  



EDITED: Added code block to above to show indentation and added share result.
Ok so for testing purposes I've used this exact smbd.conf and this is what the logs say

[2019/03/20 19:22:14.762314, 0] ../lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon 'smbd' finished starting up and ready to serve connections

But.....

[email protected]:/var/log/samba $ sudo smbstatus

Samba version 4.5.16-Debian
PID Username Group Machine Protocol Version Encryption Signing
----------------------------------------------------------------------------------------------------------------------------------------

Service pid Machine Connected at Encryption Signing
---------------------------------------------------------------------------------------------

No locked files

Shows no shares?

And I still can't see the share in Network or \\ipaddress from the W10 PC. I can see other shared devices and network discovery is on.

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

Re: SMB Samba Share - HELP ME PLEASE! :)

Wed Mar 20, 2019 9:29 pm

smbstatus shows connections not shares, try 'smbclient -L localhost'
When prompted for a password, just press 'enter'

mrsharpey
Posts: 6
Joined: Tue Mar 19, 2019 9:13 pm

Re: SMB Samba Share - HELP ME PLEASE! :)

Wed Mar 20, 2019 9:31 pm

hortimech wrote:
Wed Mar 20, 2019 9:29 pm
smbstatus shows connections not shares, try 'smbclient -L localhost'
When prompted for a password, just press 'enter'
Oh :D

Well, I feel slightly better that didn't work either.

[email protected]:/etc/openvpn $ smbclient -L localhost
-bash: smbclient: command not found

mrsharpey
Posts: 6
Joined: Tue Mar 19, 2019 9:13 pm

Re: SMB Samba Share - HELP ME PLEASE! :)

Wed Mar 20, 2019 9:58 pm

workgroup = WORKGROUP
wins support = yes

[pishare]
comment = Pi Shared Folder
path = /home/pi/shared
browsable = yes
guest ok = yes
writable = yes

This is now my smb.conf after reading it should just work.

Turned out the firewall I setup for the VPN router was blocking port 445 for SMB - SORRY! :oops:

But I'm still getting prompted for u/p when connecting to \\192.168.1.200

[email protected]:~/shared $ ls -la
total 8
drwxr-xr-x 2 pi pi 4096 Mar 19 13:43 .
drwxr-xr-x 23 pi pi 4096 Mar 19 20:06 ..

Return to “Beginners”