Discussion:
Unable to mount with mount_smbfs while smbclient works fine
(too old to reply)
twilight
2016-07-20 11:51:13 UTC
Permalink
Hello guys!

I'm trying to mount a samba share (actually a D-link sharecenter) in my
local network to my freebsd machine. But for some reason mount_smbfs
does nothing, exiting with status 1. Dmesg is empty on errors releated
to mount. PF firewall lets out packages to local network, so it must not
be the case.

I've read the man twice, the isn't anything covering the possible
errors. I'm confused, what should I do?

Here are the pf rules:
~> sudo pfctl -s rules
scrub in all fragment reassemble
block return out all
pass out quick on lo0 route-to lo1 inet proto tcp from any to
127.192.0.0/10 flags S/SA modulate state
pass quick on lo0 all flags S/SA keep state
pass quick on lo1 all flags S/SA keep state
pass out quick inet proto tcp all user = 256 flags S/SA modulate state
pass out quick route-to lo1 inet proto udp from any to any port = domain
keep state
pass out quick inet from any to 192.168.1.0/24 flags S/SA keep state
pass out quick inet from any to 192.168.0.0/24 flags S/SA keep state
pass out quick inet from any to 192.168.2.0/24 flags S/SA keep state
pass out route-to lo1 inet proto tcp all flags S/SA modulate state
***@equestria ~> sudo pfctl -s nat
rdr pass on lo1 inet proto tcp all -> 127.0.0.1 port 9040
rdr pass on lo1 inet proto udp from any to any port = domain ->
127.0.0.1 port 53


Here's an example of how it looks:

~> smbclient //192.168.2.12/Volume_1 -U guest
params.c:OpenConfFile() - Unable to open configuration file
"/usr/local/etc/smb-client.conf":
No such file or directory
smbclient: Can't load /usr/local/etc/smb-client.conf - run testparm to
debug it
Enter guest's password:
Failed to load upcase.dat, will use lame ASCII-only case sensitivity rules
Failed to load lowcase.dat, will use lame ASCII-only case sensitivity rules
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.5.15]
smb: \> pwd
Current directory is \\192.168.2.12\Volume_1\
smb:\> ⏎

~> sudo mount_smbfs -I 192.168.2.12
//***@192.168.2.12/Volume_1 /nmnt

~> echo $status
1

~> mount
zroot/ROOT/default on / (zfs, local, noatime, nfsv4acls)
devfs on /dev (devfs, local, multilabel)
bootpool on /bootpool (zfs, local, nfsv4acls)
zroot/tmp on /tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot/usr/home on /usr/home (zfs, local, noatime, nfsv4acls)
zroot/usr/ports on /usr/ports (zfs, local, noatime, nosuid, nfsv4acls)
zroot/usr/src on /usr/src (zfs, local, noatime, nfsv4acls)
zroot/var/audit on /var/audit (zfs, local, noatime, noexec, nosuid,
nfsv4acls)
zroot/var/crash on /var/crash (zfs, local, noatime, noexec, nosuid,
nfsv4acls)
zroot/var/log on /var/log (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/var/mail on /var/mail (zfs, local, nfsv4acls)
zroot/var/tmp on /var/tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot on /zroot (zfs, local, noatime, nfsv4acls)
map -hosts on /net (autofs)


If any extra information is required, I can provide it by your requests.
--
Cheers~

PGP key fingerprint:
07B3 2177 3E27 BF41 DC65 CC95 BDA8 88F1 E9F9 CEEF

You can retrieve my public key at pgp.mit.edu.
Polytropon
2016-07-20 12:24:22 UTC
Permalink
Post by twilight
I'm trying to mount a samba share (actually a D-link sharecenter) in my
local network to my freebsd machine. But for some reason mount_smbfs
does nothing, exiting with status 1. Dmesg is empty on errors releated
to mount. PF firewall lets out packages to local network, so it must not
be the case.
I've read the man twice, the isn't anything covering the possible
errors. I'm confused, what should I do?
Allow me to provide some information refactored from a post I wrote
5 years ago - I'm not fully sure it still applies today, but it did
work as intended. Even though I use mount + fstab, mount_smbfs is at
the center of this approach.



In order to use mount (mount_smbfs), provide the "login information"
as needed in /etc/nsmb.conf (replace uppercase placeholders), for example:

[default]
workgroup=YOUR_WORKGROUP_NAME

[SERVERNAME]
addr=192.168.2.2

[SERVERNAME:USERNAME]
password=TOPSECRET

where SERVERNAME and USERNAME correspond to the server's name
and the username you use to access the share (with the proper
password).

See "man nsmb.conf" for details.

You could use a hostname instead of an IP, for example by adding
an entry in /etc/hosts for the target.

Parts of the above information should then be reflected in /etc/fstab,
maybe like this:

//***@SERVERNAME/share /smb/share smbfs rw,noauto 0 0

This should allow you to use

# mount /smb/share

a bit easier (and automatically, if desired).

If the target exposes more than one share via "drive letters", you
can use a similar approach in /etc/fstab:

//***@SERVERNAME/a$ /smb/a smbfs rw,noauto 0 0
//***@SERVERNAME/c$ /smb/c smbfs rw,noauto 0 0
//***@SERVERNAME/d$ /smb/d smbfs rw,noauto 0 0
//***@SERVERNAME/e$ /smb/e smbfs rw,noauto 0 0
//***@SERVERNAME/f$ /smb/f smbfs rw,noauto 0 0

The "generic" mount command will then work as mentioned above.
--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
twilight
2016-07-20 20:24:43 UTC
Permalink
Thanks, it kinda worked, but nothing is shown in the mount point. When I
try to touch(1) a test file it is viewable through the smbclient(1), but
is not displayed with the ls(1) command. Also, none of the existing
files are shown.
Post by Polytropon
Post by twilight
I'm trying to mount a samba share (actually a D-link sharecenter) in my
local network to my freebsd machine. But for some reason mount_smbfs
does nothing, exiting with status 1. Dmesg is empty on errors releated
to mount. PF firewall lets out packages to local network, so it must not
be the case.
I've read the man twice, the isn't anything covering the possible
errors. I'm confused, what should I do?
5 years ago - I'm not fully sure it still applies today, but it did
work as intended. Even though I use mount + fstab, mount_smbfs is at
the center of this approach.
In order to use mount (mount_smbfs), provide the "login information"
[default]
workgroup=YOUR_WORKGROUP_NAME
[SERVERNAME]
addr=192.168.2.2
[SERVERNAME:USERNAME]
password=TOPSECRET
where SERVERNAME and USERNAME correspond to the server's name
and the username you use to access the share (with the proper
password).
See "man nsmb.conf" for details.
You could use a hostname instead of an IP, for example by adding
an entry in /etc/hosts for the target.
Parts of the above information should then be reflected in /etc/fstab,
This should allow you to use
# mount /smb/share
a bit easier (and automatically, if desired).
If the target exposes more than one share via "drive letters", you
The "generic" mount command will then work as mentioned above.
--
Cheers~

PGP key fingerprint:
07B3 2177 3E27 BF41 DC65 CC95 BDA8 88F1 E9F9 CEEF

You can retrieve my public key at pgp.mit.edu.
Loading...