2

I have a clean installation of Ubuntu 23.04 that I'm trying to configure to share the Public folder with a computer running Windows 10 Pro. The Windows computer is able to access shared folders from other computers on my network (Windows 7, Windows 10, Windows Server 2016/2019/2022).

I installed nautilus-share. After this, "Sharing Options" appeared in the menu. I tried the options Allow others to create and delete files in this folder and Guest access (for people without a user account). Neither made a difference.

This is the error that I'm getting on Windows.

Windows does not have read permission.

Here is the Sharing Options menu.

Here is net usershare info.

I am able to access the share on Ubuntu using "other locations".

I used smbpasswd to set the password.

I created a credential in Windows with the same username and password.

I searched and found quite a few posts about this problem, but no solutions that worked.

If anyone has any suggestions to fix this, I would really appreciate it.

(In case it matters, I am able to access files on the Windows and Windows Server computers from Ubuntu.)

yxz
  • 13
bimmerdriver
  • 33
  • 1
  • 3

3 Answers3

5

Edit /etc/samba/smb.conf and right under the workgroup = WORKGROUP line add this one:

force user = daryl

Then restart samba:

sudo service smbd restart

The problem isn't samba it's a change Ubuntu made from 22.04 on that changed the default permissions on a users home folder to 750 meaning no one other than that user can access any of it's contents.

"force user = daryl" will make the "guest" user appear to be you - for these shares.

Morbius1
  • 7,761
  • Thank you very much for the help. Your suggestion fixed the problem. – bimmerdriver Apr 23 '23 at 23:06
  • Worked for me, thanks! I tested that this also still respects read-only settings even though i am forcing it to be my user: permission denied for write is correctly thrown for guest access. – flinz May 08 '23 at 09:04
0

I did another clean installation to make sure I could get file sharing from Ubuntu to Windows working properly from scratch.

Here are the steps I used from start to finish:

Install nautilus-share:

sudo apt-get update -y
sudo apt-get install -y nautilus-share

After restarting, the Sharing Options menu was available.

However, when I tried to create a share, there was an error:

'net usershare' returned error 255: net usershare: cannot open >usershare directory /var/lib/samba/usershares. Error Permission denied >You do not have permission to create a usershare. Ask your >administrator to grant you permissions to create a share.

Screen shot of error 255.

I found the fix for this error here: File sharing through samba is not working over LAN

sudo usermod -a -G sambashare $USER

After restarting, I was able to create a share.

To test that it was working, I used + Other Locations. It did not accept my credentials because the Samba password had not been set.

I found the fix for the problem here: Install and Configure Samba

sudo smbpasswd -a *username*

After restarting, I was able access the shared folder and see the contents on Ubuntu.

Now, I was at the point where I started this post, not being able to open the shared folder on Windows. After inserting force user = daryl in smb.conf, I was able to see the contents of the shared folder on Windows.

muru
  • 197,895
  • 55
  • 485
  • 740
bimmerdriver
  • 33
  • 1
  • 3
0

Thank you for the post and the answers provided.

In my case, after installed nautilus-share and set Samba password, shared the Public folder, all I had to do was opened port 445, the SMB port:

sudo ufw allow 445

I had an exact similar problem: I did a fresh installation of Ubuntu 23.04 Lunar Lobster.

Successfully installed nautilus-share, then shared the /home/behai/Public folder via Ubuntu 23.04 UI.

I then successfully set Samba password for behai, via:

sudo smbpasswd -a behai

Still, from Windows 10, it refused to connect to \hp-pavilion-15\Public, even though it asked for Samba password.

-- hp-pavilion-15 is my machine / host name.

I did get Windows to do diagnose, but for several hours, it gave me nothing. Finally, during one of those tries, it stated that it can see hp-pavilion-15 shared files and folders online, but port 445 refused connection.


Another point I have observed, ufw seems to be inactive by default? I did enable it and restart the Ubuntu, but port 445 never entered my mind -- I am not that familiar with Linux.

I hope this helps somebody else.