Samba unable to access the directory

Solved
ludivine43 -  
mamiemando Posted messages 33537 Registration date   Status Modérateur Last intervention   -

Hello

I am desperately trying to configure Samba for sharing from my Debian to a Windows 10 VM, but to no avail (the best without a user)

  • On W10: it pings, no firewall, samba 1 installed, passwordless sharing enabled.
  • On Linux: firewall disabled
apt update  apt install samba

In the Samba configuration file:

path = to the desktop browseable = yes writable = yes  guest ok = yes  read only = no

I restarted Samba.

Permission level: chmod -R 0777 and chown -R nobody:nogroup to my path.

I tried to test the share on my Linux without Windows, impossible to access it.

I tried to add a user my base user

smbpasswd -a myuser

In the configuration file

valid users = myuser guest ok = no

and nothing works I don't understand why

Can you help me please?

4 réponses

brucine Posted messages 24396 Registration date   Status Membre Last intervention   4 098
 

Hello,

On the Linux side, I don't understand anything.

On the Windows side, there is definitely a default firewall (Windows Defender) unless it has been uninstalled, which is not easy.

It seems to me that you cannot do local Windows sharing if there is no password on the Windows side, even if it is disabled at login, and which will be required at the first network connection and could then be remembered.

Furthermore, by default, you cannot share the entire system partition C: under Windows.

0
ludivine43
 

Hello

Thank you for your response

I don't think that it's a Windows issue since I can't mount the share on the Linux side either. On the Windows side, I only see

- the firewall

- the passwordless share (for your information, I can connect perfectly in the other direction Windows ---> Linux using CIFS)

- the version of SMB 1 or 2

Right now, I think it's more of a configuration error on the Linux side, but where? I don't understand

0
brucine Posted messages 24396 Registration date   Status Membre Last intervention   4 098
 

Hello,

As I told you earlier, on the Linux side, I'm at a loss, I don't think it's necessary to enable SMB1.0 on the Windows side for Windows 10 and 11, but I did it just in case, and it doesn't hurt.

If I understood your setup correctly, I did the opposite; I have a Linux Mint virtual machine using VMWare Workstation Player set up on Windows 11.

As a remark, I don't see Linux in the Windows network environment, nor Windows in the Linux environment, and even the "Shared Folders" feature specific to VMWare doesn't work.

I haven't really tried from Windows; from Linux, but you probably aren't interested because your virtual machine is set up on Linux, I solved the problem with a convoluted workaround involving creating the shared folder in Linux:

mkdir /mnt/hgfs/Win11Desktop

and then sharing it, in the VMWare context:

sudo vmhgfs-fuse .host:/Win11Desktop /mnt/hgfs/Win11Desktop -o allow_other -o uid=1000

and finally, creating a shortcut for the folder copied into favorites for easy access. I'll spare you the additional finishings, but I'm here if you need.

0
ludivine43
 

It's a little more complicated if only I had VMware

But in my case I have

Host Linux Pop OS

VM Windows 10

Hypervisor KVM/QEMU

If I share from my Windows to my Linux using CIFS, it works

If I share from my Linux to my Windows using SAMBA, it doesn't work (but it doesn't work either from my Linux to my Linux, so for me it's not related to virtualization but to sharing)

0
ludivine43
 

I have resolved my issue, could you please close it, thank you.

Here is what I did.

Switch to a root session or use sudo on each command

su -

Install samba and smb client

On CentOS:

yum install -y samba yum install -y smbclient

On Ubuntu:

apt-get install -y samba apt-get install -y smbclient

Enable SMB on startup

systemctl enable smbd

Create a shared directory and set permissions:

mkdir /mnt/partage

(the path may be different, for example /home/user/Desktop/partage)

 chgrp -R partage /mnt/partage chmod 777 /mnt/partage groupadd partage

Make a backup of the samba configuration file

cp /etc/samba/smb.conf /etc/samba/smb.conf.old

Copy the following text into /etc/samba/smb.conf

[global] netbios name = user workgroup = WORKGROUP server string = samba from pcuser security = user guest account = nobody map to guest = Bad User # for security reasons you shouldn't allow any version below SMB2 server min protocol = SMB2 [partage] comment = data path = /mnt/partage guest ok = no read only = no browseable = yes valid users = smbuser

Restart the samba service

systemctl restart smbd

Add a Samba user

adduser smbuser smbpasswd -a smbuser gpasswd -a smbuser partage
0
mamiemando Posted messages 33537 Registration date   Status Modérateur Last intervention   7 927
 

Hello,

Thank you for your detailed feedback. However, a few comments:

  • As the author of the discussion, you can mark the topic as resolved yourself, as explained here.
  • Do not confuse the Samba client (which allows access to a share) and the Samba server (which allows sharing files). In your explanations, you mix up the two aspects a bit. Since Debian acts as the server, smbclient is only required if you want to test your share locally. It's actually a good idea to do so, as it helps in case of a problem to know whether the issue comes from the firewall or the Windows client, for example.
  • You shouldn't use chown / chgrp as you are doing, because your file system becomes too permissive locally. Since the server runs as root, there’s no reason to loosen the permissions. The permissions exposed by Samba to the Samba client (let’s say your W10) and the permissions of the local file system (thus under Debian) are independent (see particularly the read-only option). It's also recommended that when sharing, only read-only permissions are given :-)
  • Don’t forget to reactivate your firewall :-)

Also, even though it's not the initial question, I would like to point out that there are much more convenient solutions to share files to/from Linux/Windows/... such as ssh/winscp, kdeconnect, ftp, etc. Personally, I use kdeconnect.

0