[SOLVED] cannot share folder through samba

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
xpanta

[SOLVED] cannot share folder through samba

Post by xpanta »

Hi,

I am trying to share a public folder and share my printer to my laptop (Windows XP Home. Name: notebook, workgroup: WORKGROUP)
Although I can see "mint-desktop" as network node on my windows laptop, whenever I try to open it I get a "cannot connect to \\Mint-desktop... etc" message.
I, also, cannot print.

Code: Select all

chris@mint-desktop ~ $ smbtree
Enter chris's password: 
WORKGROUP
	\\NOTEBOOK       		Laptop
		\\NOTEBOOK\SharedDocs     	
		\\NOTEBOOK\IPC$           	Remote IPC
	\\MYBOOKWORLD    		My Book World Edition Network Storage
		\\MYBOOKWORLD\Public         	Public Share
		\\MYBOOKWORLD\Download       	Download Share
		\\MYBOOKWORLD\Backup         	backup data
		\\MYBOOKWORLD\Rubini         	Rubinis Data
		\\MYBOOKWORLD\LinuxHome      	Linux Home Folder
		\\MYBOOKWORLD\Configuration  	System Configuration
		\\MYBOOKWORLD\IPC$           	IPC Service (My Book World Edition Network Storage)
	\\MINT-DESKTOP   		mint-desktop server (Samba, LinuxMint)

Code: Select all

chris@mint-desktop ~ $ testparm -s
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[printers]"
Processing section "[print$]"
Processing section "[Public]"
WARNING: The security=share option is deprecated
Loaded services file OK.
Server role: ROLE_STANDALONE
[global]
	server string = %h server (Samba, LinuxMint)
	security = SHARE
	encrypt passwords = No
	map to guest = Bad User
	obey pam restrictions = Yes
	pam password change = Yes
	passwd program = /usr/bin/passwd %u
	passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
	username map = /etc/samba/smbusers
	unix password sync = Yes
	syslog = 0
	log file = /var/log/samba/log.%m
	max log size = 1000
	dns proxy = No
	usershare allow guests = Yes
	panic action = /usr/share/samba/panic-action %d
	idmap config * : backend = tdb
	hosts allow = 192.168.1.

[printers]
	comment = All Printers
	path = /var/spool/samba
	create mask = 0700
	guest ok = Yes
	printable = Yes
	print ok = Yes
	browseable = No

[print$]
	comment = Printer Drivers
	path = /var/lib/samba/printers
	read only = No
	guest ok = Yes

[Public]
	comment = Public
	path = /home/chris/Public
	read only = No
	guest ok = Yes

Code: Select all

chris@mint-desktop ~ $ net usershare info --long
chris@mint-desktop ~ $ 
Any help will be appreciated.

Thanks
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 3 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
altair4
Level 20
Level 20
Posts: 11427
Joined: Tue Feb 03, 2009 10:27 am

Re: cannot share folder through samba

Post by altair4 »

Edit smb.conf as root:

Code: Select all

gksu gedit /etc/samba/smb.conf
Change this:
security = SHARE
encrypt passwords = No
TO this:
security = USER
encrypt passwords = Yes
Save the file and restart smbd:

Code: Select all

sudo service smbd restart
Unfortunately every time you restart smbd the network has a hissy fit so wait a few minutes and see if you can connect.

There is one more potential problem:
[Public]
comment = Public
path = /home/chris/Public
read only = No
guest ok = Yes
/home/chris/Public has permissions of 775 but your share allows guest write access so Linux itself will prevent a write by an anonymous guest. You have a couple of options:

[1] Change permissions on the shared folder to allow "others" to write to the folder:

Code: Select all

sudo chmod 777 /home/chris/Public
[2] Force the remote guest to appear to be "chris" for that share:
[Public]
comment = Public
path = /home/chris/Public
read only = No
force user = chris
guest ok = Yes
And then restart smbd again. In this case when the remote guest tries to access the share his identity will be converted to chris and everything he accesses or saves will be as chris.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
xpanta

Re: cannot share folder through samba

Post by xpanta »

Hi,

Thank you very much for your answer.

However, I still cannot connect from my Windows XP Laptop. And it is not a problem with my Windows XP because I can connect to my network storage.

I did the modifications you suggested and here is the new output:

(net usershare info --long and smbtree give me nothing)

Code: Select all

chris@mint-desktop ~ $ testparm -s
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[printers]"
Processing section "[print$]"
Processing section "[Public]"
Loaded services file OK.
Server role: ROLE_STANDALONE
[global]
	server string = %h server (Samba, LinuxMint)
	map to guest = Bad User
	obey pam restrictions = Yes
	pam password change = Yes
	passwd program = /usr/bin/passwd %u
	passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
	username map = /etc/samba/smbusers
	unix password sync = Yes
	syslog = 0
	log file = /var/log/samba/log.%m
	max log size = 1000
	dns proxy = No
	usershare allow guests = Yes
	panic action = /usr/share/samba/panic-action %d
	idmap config * : backend = tdb
	hosts allow = 192.168.1.

[printers]
	comment = All Printers
	path = /var/spool/samba
	force user = chris
	create mask = 0700
	guest ok = Yes
	printable = Yes
	print ok = Yes
	browseable = No

[print$]
	comment = Printer Drivers
	path = /var/lib/samba/printers
	force user = chris
	read only = No
	guest ok = Yes

[Public]
	comment = Public
	path = /home/chris/Public
	force user = chris
	read only = No
	guest ok = Yes
snison

Re: cannot share folder through samba

Post by snison »

There has been more than one machine on Mint Nadia I've had to force the user, as described above.

Code: Select all

read only = No
force user = chris
guest ok = Yes
But when you say cannot connect, does that mean it pops up a username/password box, doesn't connect at all, etc? Have you restarted the XP box?
altair4
Level 20
Level 20
Posts: 11427
Joined: Tue Feb 03, 2009 10:27 am

Re: cannot share folder through samba

Post by altair4 »

Add a line under the workgroup line in smb.conf:

Code: Select all

name resolve order = bcast host lmhosts wins
Then restart samba:

Code: Select all

sudo service smbd restart

Code: Select all

sudo service nmbd restart
Wait 5 minutes and then run smbtree again.

If there is no output disable the firewall on Mint and try it again:

Code: Select all

sudo ufw disable
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
xpanta

Re: cannot share folder through samba

Post by xpanta »

Thank you.

disabling the firewall did it!

But does that mean that I have no firewall, now? Can I configure firewall to accept incoming requests from the laptop?

I know it is another topic, but if you tell me it can be done, I will find a way (hopefully -- or start a new thread) :-)
altair4
Level 20
Level 20
Posts: 11427
Joined: Tue Feb 03, 2009 10:27 am

Re: cannot share folder through samba

Post by altair4 »

When samba installs it creates a file at /etc/ufw/applications.d which defines which ports need to be opened on an enabled firewall. So you should be able to enable your firewall again and run the following command to open the samba ports:

Code: Select all

sudo ufw allow Samba
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Locked

Return to “Networking”