wkeeling
Posts: 121
Joined: Fri Aug 25, 2017 2:16 pm
Location: Houston Texas
Contact: Facebook

Samba shared to window 10

Wed Jul 28, 2021 1:46 am

Can samba be configured the shared pi files to windows 10 without knowing workgroup or domainof the window machine?
Willie Keeling

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

Re: Samba shared to window 10

Wed Jul 28, 2021 12:34 pm

wkeeling wrote:
Wed Jul 28, 2021 1:46 am
Can samba be configured the shared pi files to windows 10 without knowing workgroup or domainof the window machine?
Yes
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

wkeeling
Posts: 121
Joined: Fri Aug 25, 2017 2:16 pm
Location: Houston Texas
Contact: Facebook

Re: Samba shared to window 10

Wed Jul 28, 2021 8:40 pm

touche :) if so how?
Willie Keeling

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

Re: Samba shared to window 10

Wed Jul 28, 2021 11:04 pm

wkeeling wrote:
Wed Jul 28, 2021 8:40 pm
touche :) if so how?
Samer way you'd configure it if you knew the workgroup: https://www.raspberrypi.org/documentati ... s/samba.md
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

wkeeling
Posts: 121
Joined: Fri Aug 25, 2017 2:16 pm
Location: Houston Texas
Contact: Facebook

Re: Samba shared to window 10

Wed Jul 28, 2021 11:12 pm

That is the way I configured it but still unseen on PC. Enabled SMB client on PC but still nothing. I must be missing something.
Willie Keeling

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

Re: Samba shared to window 10

Wed Jul 28, 2021 11:20 pm

wkeeling wrote:
Wed Jul 28, 2021 11:12 pm
That is the way I configured it but still unseen on PC. Enabled SMB client on PC but still nothing. I must be missing something.
If you're expecting network browing to work, it won't. That requires SMBv1 which is disabled by default on Windows 10 (because it's insecure). You should still be abel to access the server by \\server-name or \\server-ip-address

Either enable SMBv1 on each Windos 10 client (Control Panel, Programs & Features, Turn windows features on or off) or install wsdd on the Pi(https://github.com/christgau/wsdd).
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

wkeeling
Posts: 121
Joined: Fri Aug 25, 2017 2:16 pm
Location: Houston Texas
Contact: Facebook

Re: Samba shared to window 10

Thu Jul 29, 2021 6:39 pm

I have SMBv1 client enabled on the window10. I have tried to both \\name\share and \\ip\share and neither can connect. I see and empty log with the client name so it looks to be getting to the pi samba process.
Willie Keeling

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

Re: Samba shared to window 10

Thu Jul 29, 2021 11:11 pm

wkeeling wrote:
Thu Jul 29, 2021 6:39 pm
I have SMBv1 client enabled on the window10. I have tried to both \\name\share and \\ip\share and neither can connect. I see and empty log with the client name so it looks to be getting to the pi samba process.
I'm going to need more information:
  • The output from

    Code: Select all

    testparm -s
    in code tags.
  • Are you clients connecting as guests or with a full login?
  • If with a full login have you created samba users for them?
  • Have you created the corresponding linux users?
  • The output of

    Code: Select all

    ls -ld
    on the shared directory (on the server)
  • If the shared directory is on a different device to the root file system (e.g. a mounted USB drive) what file system type has it been formatted with, how has it been mounted (desktop automounter, fstab, manully command, etc) and with what mount options?
  • What error, if any, is windows reporting?
But before you post all that, try a forum and web search. Don't restrict the web search to PI or RPiOS.

While I'm still guessing (I don't have enough information to do otherwise), I'd guess at a credentials or permissions problem. Remember: samba can't grant permissions to clients that the OS doesn't grant to it.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

wkeeling
Posts: 121
Joined: Fri Aug 25, 2017 2:16 pm
Location: Houston Texas
Contact: Facebook

Re: Samba shared to window 10

Fri Jul 30, 2021 12:06 am

thagrol wrote:
Thu Jul 29, 2021 11:11 pm

I'm going to need more information:
  • The output from

    Code: Select all

    testparm -s
    in code tags.
  • Are you clients connecting as guests or with a full login?
  • If with a full login have you created samba users for them?
  • Have you created the corresponding linux users?
  • The output of

    Code: Select all

    ls -ld
    on the shared directory (on the server)
  • If the shared directory is on a different device to the root file system (e.g. a mounted USB drive) what file system type has it been formatted with, how has it been mounted (desktop automounter, fstab, manully command, etc) and with what mount options?
  • What error, if any, is windows reporting?
But before you post all that, try a forum and web search. Don't restrict the web search to PI or RPiOS.

While I'm still guessing (I don't have enough information to do otherwise), I'd guess at a credentials or permissions problem. Remember: samba can't grant permissions to clients that the OS doesn't grant to it.
pi@cm4num2:~ $ testparm -s
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[CamShare]"
Loaded services file OK.
Server role: ROLE_STANDALONE

# Global parameters
[global]
log file = /var/log/samba/log.%m
logging = file
map to guest = Bad User
max log size = 1000
obey pam restrictions = Yes
pam password change = Yes
panic action = /usr/share/samba/panic-action %d
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
passwd program = /usr/bin/passwd %u
server role = standalone server
unix password sync = Yes
usershare allow guests = Yes
idmap config * : backend = tdb


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


[CamShare]
guest ok = Yes
hosts allow = 192.168.4.
path = /home/pi/CamShare
read only = No


pi@cm4num2:~/CamShare $ ls -ld
drwxr----- 2 pi pi 4096 Jul 26 18:37 .
not sure about guest vs full logon -- I did do the samba user setup "sudo smbpasswd -a pi". the windows side I just go into file explorer --> Add Network Location

[img]file:///C:/Users/wkeeling/Documents/Snagit/Window_image.png[/img] (also how do I include a image)

the /var/log/samba does not look to have anything but normal looking start up messges.

I have searched the pi forum and internet before I posted.

Thanks in advance for all your help for a samba noob
Willie Keeling

wkeeling
Posts: 121
Joined: Fri Aug 25, 2017 2:16 pm
Location: Houston Texas
Contact: Facebook

Re: Samba shared to window 10

Fri Jul 30, 2021 12:58 am

Another data point -- when I try to open the share on the windows client 2 empty log are created (one with client IP and one with client hostname)

Code: Select all

pi@cm4num2:/var/log/samba $ ls -al
total 16
drwxr-x--- 3 root adm  4096 Jul 29 19:54 .
drwxr-xr-x 5 root root 4096 Jul 29 18:18 ..
drwx------ 4 root root 4096 Jul 26 18:35 cores
-rw-r--r-- 1 root root    0 Jul 29 19:54 log.192.168.4.4
-rw-r--r-- 1 root root  168 Jul 29 19:54 log.smbd
-rw-r--r-- 1 root root    0 Jul 29 19:54 log.txhqwkeeli-l1
Willie Keeling

wkeeling
Posts: 121
Joined: Fri Aug 25, 2017 2:16 pm
Location: Houston Texas
Contact: Facebook

Re: Samba shared to window 10

Fri Jul 30, 2021 1:41 am

when I connect by pi server name \\racecam.wlan\CamShare it prompt me for a user and password. but no matter how I enter the pi user and password I get name or password is incorrect. How do I select local pi user and bypass the default domain.

by ip does not prompt and give message "The folder you entered does not appear to be valid"
by either name that resolve to the ip I get a window to enter user and password by can get past it
Willie Keeling

bls
Posts: 1680
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Samba shared to window 10

Fri Jul 30, 2021 2:46 am

wkeeling wrote:
Fri Jul 30, 2021 1:41 am
when I connect by pi server name \\racecam.wlan\CamShare it prompt me for a user and password. but no matter how I enter the pi user and password I get name or password is incorrect. How do I select local pi user and bypass the default domain.

by ip does not prompt and give message "The folder you entered does not appear to be valid"
by either name that resolve to the ip I get a window to enter user and password by can get past it
Does this help? (do this on the pi, obviously)

Code: Select all

sudo smbpasswd -a pi 
Pi tools:
Quickly and easily build customized-just-for-you SSDs/SD Cards: https://github.com/gitbls/sdm
Easily run and manage your network's DHCP/DNS servers on a Pi: https://github.com/gitbls/ndm
Easy and secure strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

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

Re: Samba shared to window 10

Fri Jul 30, 2021 12:19 pm

OK.

Firstly, permissons on the shared directory are unusual. rwxr-----means only the owner (linux user pi) can access it. DIrectories need X permission in order to be readable. Change permissions on that directory to at least rwxr-xr-x.

Secondly, I see you have the default [HOMES] share enabled. Are you able to access \\server-name-or-ip\pi? If so what happens when you try to access the CamShare directory through that?

Thirdly, try removing the following from the share configuration:

Code: Select all

hosts allow = 192.168.4.
Restricting host to the entire subnet is pointless unless your server is accessable from another subnet (i.e. it has multiple interfaces or you've configured port forwarding on your router). It's also going to be problematic if yout test bench uses a different subnet to the final one.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

wkeeling
Posts: 121
Joined: Fri Aug 25, 2017 2:16 pm
Location: Houston Texas
Contact: Facebook

Re: Samba shared to window 10

Sat Jul 31, 2021 12:37 am

sudo smbpasswd -a pi had been run with the same password supplied as the pi OS user.

I tried all of your ideas whit now change in failure mode (by pi server name windows prompts for user and password and fails with invalid user or name, by ip does not prompt for user/password and fails "'the folder you entered do not appear to be valid" message)

open directory permissions -- no change in above failure modes.
pi@cm4num2:~ $ ls -al camshare
total 8
drwxr-xr-x 2 pi pi 4096 Jul 26 18:37 .
drwxr-xr-x 9 pi pi 4096 Jul 30 19:18 ..

connect to home directory -- same failure modes.

removed the "host allow" (I had just add that based on another post) -- same failure modes.

removed the [homes] section (as I am not using that it was just in the demo conf file) -- same failure modes.

here is the conf I am using now and I would like to make a minimum conf let me know what you think that would be:

Code: Select all

[global]
   workgroup = WORKGROUP
   log file = /var/log/samba/log.%m
   max log size = 1000
   logging = file
   panic action = /usr/share/samba/panic-action %d
   server role = standalone server
   obey pam restrictions = yes
   unix password sync = 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
   map to guest = bad user
   usershare allow guests = yes

[camshare]
    path = /home/pi/camshare
    read only = no
    public = yes
    writable = yes
    browseable=yes
    public=yes
Willie Keeling

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

Re: Samba shared to window 10

Sat Jul 31, 2021 11:08 am

Did you reboot your windows box between trying by name and by IP? If not windows will have remembered the credentials used last time and not prompted for them.

When you first ran smbpasswd -a did you do so as root or as your normal user?

Check every directory in the path to camshare has at least r-x permissions for all users

Check letter case of the path in your smb.conf against actuall letter case on disc. Unlike windows, case matters.

I can see nothing obvious in your smb.conf. You have public = yes and public=yes in your share definition. I suggest you remove the second one.

I usually run with unix password sync = no. Having it enabled does more harm than good.

i don't have a minimal smb.conf to hand. I suggest you refer to https://www.samba.org/samba/docs/curren ... onf.5.html and remove any lines from yours that have the default value.

Lastly, there seem to be multiple possible causes so I'm going to eliminate one of them:

Code: Select all

sudo smbpasswd -x pi
That will delete the pi smb user and force guest access to be used which should eliminate any issues related to invalid username or password.

If that works, you may hit permissions issues so either add global write permission to the directory or add the following to the share definition:

Code: Select all

force group = pi
force user = pi
And don't forget to restart smbd after making any changes to smb.conf
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

wkeeling
Posts: 121
Joined: Fri Aug 25, 2017 2:16 pm
Location: Houston Texas
Contact: Facebook

Re: Samba shared to window 10

Mon Aug 02, 2021 1:39 am

I did not do the test writen about about (other the removing the extra public line and changing unix sync to no).

I had the idea to test from a different Windows 10 client. I can connect both by IP and Pi server name with out issues or prompting for user/password. This PC is not part of a AD domain just in the default workgroup of “workgroup” (the PC that is not able to connect is part of a AD domain although not connect to the domain when trying to mount the samba share).

The only issues with workgroup PC are I cannot update (delete or save) file on the samba share with the current configuration. I have set the permission on the PC directory wide open “rwxrwxrwx”.

I would like to (need to) share to any computer (both workgroup and domain PCs). The data on the share is not sensitive so security is a much lower preference for me versus easy generic sharing .
I hope these new data points give someone an idea what I have wrong.

Thanks
Willie Keeling

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

Re: Samba shared to window 10

Mon Aug 02, 2021 9:00 am

It sounds like you only need guest access, try changing smb.conf to this:

Code: Select all

[global]
        map to guest = Bad User
        log file = /var/log/samba/%m
        log level = 1

[guest]
        # This share allows anonymous (guest) access
        # without authentication!
        path = /srv/samba/guest/
        read only = no
        guest ok = yes
        guest only = yes
Then create the share dir:

Code: Select all

mkdir -p /srv/samba/guest/
Set permissions on the directory:

Code: Select all

chmod 2775 /srv/samba/guest/
Do not create any Samba users, delete any that exist.

Now try to connect to the share, if you cannot connect from a Windows 10 PC, then you are most likely running into the problem that the latest Win10 builds will not connect to a guest share. If this is the case, you need to alter a setting to allow guest access.

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

Re: Samba shared to window 10

Mon Aug 02, 2021 10:42 am

wkeeling wrote:
Mon Aug 02, 2021 1:39 am
I did not do the test writen about about (other the removing the extra public line and changing unix sync to no).
That wasn't suggested as a test but rather as a permanent change.
I had the idea to test from a different Windows 10 client. I can connect both by IP and Pi server name with out issues or prompting for user/password. This PC is not part of a AD domain just in the default workgroup of “workgroup” (the PC that is not able to connect is part of a AD domain although not connect to the domain when trying to mount the samba share).
I've no experience of configuring samba in an AD environment so all I can do is suggest, again, that you delete the samba user and try guest access. That and refer you to thye doccs at https://www.samba.org/
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

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

Re: Samba shared to window 10

Mon Aug 02, 2021 12:21 pm

thagrol wrote:
Mon Aug 02, 2021 10:42 am

I've no experience of configuring samba in an AD environment so all I can do is suggest, again, that you delete the samba user and try guest access. That and refer you to thye doccs at https://www.samba.org/
A) I have lots of experience of Samba in AD
B) where do you think the data in my last post came from ?

Using a standalone server in an AD domain will work, but I would only use it for guest access. If you wander into the realms of using usernames and passwords, this will also work, but you will have to create the same usernames as already exist in AD, with the same passwords. The only problem is that they will never be the same users, even with the same names. The big problem comes if you want to join the standalone server to the domain, all the data stored in the shares will belong to the standalone users, but will shown by their ID numbers and not names after the join.

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

Re: Samba shared to window 10

Mon Aug 02, 2021 6:26 pm

hortimech wrote:
Mon Aug 02, 2021 12:21 pm
thagrol wrote:
Mon Aug 02, 2021 10:42 am

I've no experience of configuring samba in an AD environment so all I can do is suggest, again, that you delete the samba user and try guest access. That and refer you to thye doccs at https://www.samba.org/
A) I have lots of experience of Samba in AD
I know you do.
B) where do you think the data in my last post came from ?
A lifetime of experience of course.

My comments were aimed at the OP not you. I'w well aware that you have both mroe samba experience than I do and are linked to the dev team.

I'm sorry if that wasn't clear.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

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

Re: Samba shared to window 10

Mon Aug 02, 2021 9:03 pm

thagrol wrote:
Mon Aug 02, 2021 6:26 pm

My comments were aimed at the OP not you. I'w well aware that you have both mroe samba experience than I do and are linked to the dev team.

I'm sorry if that wasn't clear.
No, I am sorry, I could have worded that better and I wasn't pointing it at you. :oops:

What I was trying to point out was that whilst you have admitted to have limited experience with AD, I do have. You also pointed the OP to the Samba wiki (which is always a good idea), I, in an ham fisted way, was trying to point out that is where my data came from.

If the OP has access to a domain, I would always recommend joining all machines to it, it just makes it easier.
If you set up a standalone server in an AD domain and then later want to join it to the domain, that is where the problems start. I have heard of people with standalone servers with 3TB of data owned by hundreds of users, who have then joined the server to the domain, at this point, they come to the samba mailing list asking for help.

wkeeling
Posts: 121
Joined: Fri Aug 25, 2017 2:16 pm
Location: Houston Texas
Contact: Facebook

Re: Samba shared to window 10

Thu Aug 05, 2021 1:08 am

hortimech tried the guest setup and i get the same results (able to mount on workgroup, read but not write and on the AD machine still can not mount).

Thanks for your ideas
Willie Keeling

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

Re: Samba shared to window 10

Thu Aug 05, 2021 7:20 am

wkeeling wrote:
Thu Aug 05, 2021 1:08 am
hortimech tried the guest setup and i get the same results (able to mount on workgroup, read but not write and on the AD machine still can not mount).

Thanks for your ideas
Then it is highly likely something else is going on, please post the entire output of:

Code: Select all

testparm -s
What are you trying to share ? Is it a directory on the rpi or a USB of some type ?
Whatever it is, what is the filesystem, ownership and permissions.

wkeeling
Posts: 121
Joined: Fri Aug 25, 2017 2:16 pm
Location: Houston Texas
Contact: Facebook

Re: Samba shared to window 10

Thu Aug 05, 2021 10:45 pm

Code: Select all

pi@racecam1:~ $ testparm -s
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[guest]"
Loaded services file OK.
Server role: ROLE_STANDALONE

# Global parameters
[global]
        log file = /var/log/samba/%m
        map to guest = Bad User
        idmap config * : backend = tdb


[guest]
        guest ok = Yes
        guest only = Yes
        path = /srv/samba/guest/
        read only = No
I am sharing local storage.

Code: Select all

pi@racecam1:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        29G  2.7G   25G  10% /
devtmpfs        590M     0  590M   0% /dev
tmpfs           719M     0  719M   0% /dev/shm
tmpfs           719M  9.5M  709M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           719M     0  719M   0% /sys/fs/cgroup
/dev/mmcblk0p1  253M   48M  205M  19% /boot
tmpfs           144M     0  144M   0% /run/user/1000
pi@racecam1:~ $ ls -al /srv
total 12
drwxr-xr-x  3 pi   pi   4096 Aug  2 22:33 .
drwxr-xr-x 18 root root 4096 Aug  5 17:28 ..
drwxr-xr-x  3 pi   pi   4096 Aug  2 22:33 samba
pi@racecam1:~ $ cd /srv/
pi@racecam1:/srv $ ls -al samba
total 12
drwxr-xr-x 3 pi pi 4096 Aug  2 22:33 .
drwxr-xr-x 3 pi pi 4096 Aug  2 22:33 ..
drwxrwsr-x 2 pi pi 4096 Aug  2 22:33 guest
pi@racecam1:/srv $ cd samba
pi@racecam1:/srv/samba $ ls -al guest
total 8
drwxrwsr-x 2 pi pi 4096 Aug  2 22:33 .
drwxr-xr-x 3 pi pi 4096 Aug  2 22:33 ..
Willie Keeling

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

Re: Samba shared to window 10

Thu Aug 05, 2021 11:50 pm

The inability to write is caused by current permissions on /srv/samba/guest/. You need write permission for all users (i.e. in the last group).

AFAIK having the setgid bit set won't allow non group members to write to the directory.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Return to “Networking and servers”