Solved mount_smbfs refusing to mount: Connection refused

I can't mount a Samba share to a node using mount_smbfs. Here is the set up:

  1. FreeBSD 10.2-RELEASE running GENERIC is a guest inside a VirtualBox VM using its Bridged Adapter option. I've tried switching it to a NAT adapter but it makes no difference. The Samba version is net/samba42 (installed as a package).
  2. The Samba server is a Raspberry Pi running Arch Linux Arm and is fully up-to-date. All machines are on the same LAN and there are no firewalls between them.
  3. My other Windows and Linux boxes can connect to the Samba server without problems (well, Windows sometimes has credentials dementia...).
  4. From FreeBSD, I can connect to the Samba server from within PCManFM by typing smb://anthony@raspberry_pi/Raspberry into the address bar and filling out the credentials in the dialogue boxes that follow. I can also connect using smbclient by issuing smbclient "//raspberry_pi/RPi Home" /mnt/RPi_Home in a terminal. I can also list all of the public shares using smbclient -L raspberry_pi -U%. To me, this suggests that the Samba server isn't misconfigured.

However, no matter what permutation of mount_smbfs I use, I always seem to end up with a "Connection refused" error:

Code:
mount_smbfs -I 192.168.1.7 "//anthony@raspberry_pi/RPi Home" /mnt/RPi_Home
Password:
mount:smbfs: unable to open connection. syserr = Connection refused

I've tried including other options like -W and -U in there but it doesn't make a difference. -I seems to be mandatory though; if I leave it out then mount_smbfs will tell me that it can't find the server address. I've also tried going all-IP address (e.g., <...> -I 192.168.1.7 "//anthony@192.168.1.7<...>), to no effect.

Ultimately, my goal is to mount my shares in /etc/fstab, but I figure that if I can't get mount_smbfs to work from a terminal first, then there's no sense in trying to complicate matters.

After spending a few days reading through the relevant Handbook pages and searching through this forum and the mailing lists, I'm out of ideas. I've looked through the Samba server's logs and systemd journal, but there are no clues that I can find. So at this point I'd be appreciative of any advice or tips that I could try out.
 
Whenever I wanted to mount a Samba share as a user on a fresh install, I had to issue the following command first:
Code:
chmod 4555 /usr/sbin/mount_smbfs

It has been noted that this is insecure, but it's the only way I've found that works in my installs.
 
I'm not sure if this help you guys, but I found it a week or two ago in the ports and it been working great for me sysutils/fusefs-smbnetfs.

I'm using it to mount an external hard drive (3 TB Seagate backup something or other) that is connected to my home router. This way I can use it for multiple machines and OSes and streaming content to a Roku device.
 
Last edited by a moderator:
Hi metsuke,

thank you for the reply. Unfortunately, it did not work for me. I believe that there is other problem here; as I reported, I can connect to two Linux/GNU machines, when I try to connect to the UNIX server, dmesg(8) reports
Code:
smb-maperror:NetBIOS name is invalid
, although I have confirmed from a Windows machine that the NetBIOS name is correct.

Is there a way to contact the maintainer? A simple search reveals that I am not the only one having the problem, and it would stand to argue that net-smb36 functionality is rather important.

Hi roddierod,

thank you, but I would rather have the issue resolved, rather than installing another port if not necessary.

Kindest regards,

M
 
Last edited by a moderator:
Hi metsuke,

Thank you for trying to help. Yes, the error is the same whether I use the reported NetBIOS name or the IP address. In addition, I have defined the relationship between the reported NetBIOS name and the IP address in the /etc/hosts.

Indeed, I can mount the Linux shares regardless of whether I use the NetBIOS name of the IP address.

I can mount the Linux shares and the UNIX shares from Linux, from UNIX, and from Windows, just not from FreeBSD.

That is, why I believe that there must be an implementation bug.

Kindest regards,

M
 
If you use mount_smbfs, then you must use the file /etc/nsmb.conf:
This my file:
Code:
[default]
  workgroup=WORKGROUP
[NEMO-PC]
  addr=192.168.1.3
[NEMO-PC:AMANDA]
  password=myverylongpassword
and fstab:
Code:
//AMANDA@NEMO-PC/SHARA   /mnt   smbfs   ro,codepage=utf8   0   0
 
Hi StainlessRat,

thank you for the reply. As I understand it, the file is not needed, because all the necessary parameters are passed in the command line. Additionally, I can connect to two different Linux machines without the file.

Nevertheless, I am so desperate to try it.

Kindest regards,

M
 
Can you try using Samba36 instead? I have not needed to venture in to Samba42 yet, and therefore all my answers are skewed towards the wrong version. That does not mean that I don't think Samba4 should work, but at the same time, I think that if you can get Samba36 to work fine while testing, then you can also get Samba42 to work if that is the way you want to go.
 
I hate to bump this old thread, but I'd like to add that I found a solution to my problem. The issue was to simply specify port 445, as such:

Code:
sudo mount_smbfs -I server_ip -W workgroup //user_on_server@server_ip:445/share_name /mount/point

If you connect over NetBIOS, try ports 137, 138, and 139. Port 445 seems to be used exclusively by CIFS.

I'm also not sure if it makes a difference, but I'm now running FreeBSD 10.3-RELEASE on bare metal whereas before I was running 10.2-RELEASE in Virtualbox.
 
This is completely unsolved! Why is confusingly marked as solved?
If I'm wrong, where is the solving solution?
Thanks
 
FTR

This is completely unsolved! Why is confusingly marked as solved?
If I'm wrong, where is the solving solution?
Thanks

This was solved in 2016 in the context of using SAMBA protocol version SMBv1 instead of SMBv2 or SMBv3.

Newer SAMBA versions (net/samba4xx) do understand versions 2 and 3, but FreeBSD's mount_smbfs does not. So today, the solution from May 2016 does not work anymore.
 
Hi Jungs,
Danke euch sind super, habt ihr mich auch geholfen.

Ich habe noch eine Frage.
Bei mir funtioniert es irgendwie nicht.
Jedesmal kommt mount_smbfs: unable to open connection: syserr = Connection reset by peer


Hey guys,
Thank you you are great, you helped me too.

I have another question.
Somehow it doesn't work for me.
Every time I get mount_smbfs: unable to open connection: syserr = Connection reset by peer

Code:
mount_smbfs -I xxx.xx.xx.xxx //administrator@xxx.xx.xx.xxx/Elements2 /mnt/rzpool

rzpool sind mein FreeNAS pool
Elements2 ist mein WD Elements 14TB USB3 extra Backup copie.

Elements2 ist vollzugriff eingerichtet.

Vielen Dank!
Es wäre sehr wichtig.
 
I hate to bump this old thread, but I'd like to add that I found a solution to my problem. The issue was to simply specify port 445, as such:

Code:
sudo mount_smbfs -I server_ip -W workgroup //user_on_server@server_ip:445/share_name /mount/point

If you connect over NetBIOS, try ports 137, 138, and 139. Port 445 seems to be used exclusively by CIFS.

I'm also not sure if it makes a difference, but I'm now running FreeBSD 10.3-RELEASE on bare metal whereas before I was running 10.2-RELEASE in Virtualbox.
this worked for me on 11.3 release p14. This was done on freenas. smb version on server is 3.1

root@nas04[~]# mount_smbfs -I 192.168.1.210 -W ADDomainName -U username //username@IpAddress:445/ShareName /mnt/test209/
 
Back
Top