# CIFS question[SOLVED]

## jserink

Hi All:

Why does this work:

smbclient -L mariadell -U xeroxscanner

But this doesn't:

 mount -t cifs //mariadell/xeroxscan /mnt/trimhome -o rw,username='mariadell\xeroxscanner',password=xxxxxx,uid=jserink,gid=users

mount error: could not resolve address for mariadell: Name or service not known

No ip address specified and hostname not found

why does smbclient not fail with the 'could not resolve address' message but mount does?

is there any way I can make mount do the CIFS (netobios) name lookup that smbclient appears to be doing?

Cheers,

johnLast edited by jserink on Tue Jun 28, 2011 7:03 am; edited 1 time in total

----------

## audiodef

What do you have in /etc/hosts?

----------

## jserink

 *audiodef wrote:*   

> What do you have in /etc/hosts?

 

jserinkturion qemu # cat /etc/hosts

# /etc/hosts: Local Host Database

#

# This file describes a number of aliases-to-address mappings for the for 

# local hosts that share this file.

#

# In the presence of the domain name service or NIS, this file may not be 

# consulted at all; see /etc/host.conf for the resolution order.

#

# IPv4 and IPv6 localhost aliases

127.0.0.1	localhost

::1		localhost

127.0.0.1       jserinkturion

10.1.46.101     dayton.am.trimblecorp.net

10.3.2.222      nzc-ap-ter-03

10.1.46.83      webfoot.trimble.com

10.1.46.83      globalhome.trimble.com

10.3.0.168      nzc-ap-xch-03

10.3.0.164      nzc-ap-ter-02

10.3.0.141      nz01cds02

10.1.148.139    teller.eng.trimble.com

10.3.2.136      ishelpdesk.trimblecorp.net

#

# Imaginary network.

#10.0.0.2               myname

#10.0.0.3               myfriend

#

# According to RFC 1918, you can use the following IP networks for private 

# nets which will never be connected to the Internet:

#

#       10.0.0.0        -   10.255.255.255

#       172.16.0.0      -   172.31.255.255

#       192.168.0.0     -   192.168.255.255

#

# In case you want to be able to connect directly to the Internet (i.e. not 

# behind a NAT, ADSL router, etc...), you need real official assigned 

# numbers.  Do not try to invent your own network numbers but instead get one 

# from your network provider (if any) or from your regional registry (ARIN, 

# APNIC, LACNIC, RIPE NCC, or AfriNIC.)

#

See?

When using smbclient it appears that samba is using Netbios to resolve the IP form the hostname.

When using mount, that no longer works.

Is there a way to force mount to use netbios to resolve the IP?

Cheers,

John

----------

## audiodef

 *jserink wrote:*   

> 
> 
>  mount -t cifs //mariadell/xeroxscan /mnt/trimhome -o rw,username='mariadell\xeroxscanner',password=xxxxxx,uid=jserink,gid=users
> 
> mount error: could not resolve address for mariadell: Name or service not known
> ...

 

"mariadell" is not defined in /etc/hosts. Once you do that, it should work.

----------

## jserink

 *audiodef wrote:*   

>  *jserink wrote:*   
> 
>  mount -t cifs //mariadell/xeroxscan /mnt/trimhome -o rw,username='mariadell\xeroxscanner',password=xxxxxx,uid=jserink,gid=users
> 
> mount error: could not resolve address for mariadell: Name or service not known
> ...

 

:)

I already know that.

What I want to know is WHY smbclient works without it in the hosts file.

John

----------

## audiodef

I assume that smbclient crawls your local network asking each machine "are you x?" whereas mount depends on the hosts file.

----------

## Anon-E-moose

Does it mount if you use the "ip address" instead of "mariadell"?

What does "nmblookup mariadell" return?

You might try adding "wins" to the end of the hosts line in /etc/nsswitch.conf

```
hosts:       files dns wins
```

----------

## audiodef

 *Anon-E-moose wrote:*   

> 
> 
> nmblookup
> 
> 

 

 :Laughing:   :Laughing:   :Laughing: 

This must be what Dracula uses when connecting a network drive. "Kompyootuh, pleass to puhforum un enemBLOOkup..."

----------

## jserink

 *Anon-E-moose wrote:*   

> Does it mount if you use the "ip address" instead of "mariadell"?
> 
> What does "nmblookup mariadell" return?
> 
> You might try adding "wins" to the end of the hosts line in /etc/nsswitch.conf
> ...

 

Hi All:

Ok, IS made me change the computer name to mchua-spsl but here is the output:

jserinkturion qemu # nmblookup mchua-spsl

querying mchua-spsl on 10.3.36.255

10.3.36.26 mchua-spsl<00>

That is a neat command, nmblookup.

This works:

jserinkturion qemu # smbclient -L mchua-spsl -U xeroxscanner

Enter xeroxscanner's password: 

Domain=[AP] OS=[Windows 7 Professional 7600] Server=[Windows 7 Professional 6.1]

	Sharename       Type      Comment

	---------       ----      -------

	ADMIN$          Disk      Remote Admin

	C$              Disk      Default share

	IPC$            IPC       Remote IPC

	xeroxscan       Disk      

Domain=[AP] OS=[Windows 7 Professional 7600] Server=[Windows 7 Professional 6.1]

	Server               Comment

	---------            -------

	Workgroup            Master

	---------            -------

Made the change to /etc/nsswitch.conf, same issue:

jserinkturion jserink # mount -t cifs //mchua-spsl/xeroxscan /mnt/temp -o rw,username=xeroxscanner,password=xerox_123,uid=jserink,gid=users

mount error: could not resolve address for mchua-spsl: Name or service not known

No ip address specified and hostname not found

jserinkturion jserink # cat /etc/nsswitch.conf

# /etc/nsswitch.conf:

# $Header: /var/cvsroot/gentoo/src/patchsets/glibc/extra/etc/nsswitch.conf,v 1.1 2006/09/29 23:52:23 vapier Exp $

passwd:      compat

shadow:      compat

group:       compat

# passwd:    db files nis

# shadow:    db files nis

# group:     db files nis

hosts:       files dns wins

networks:    files dns

services:    db files

protocols:   db files

rpc:         db files

ethers:      db files

netmasks:    files

netgroup:    files

bootparams:  files

automount:   files

aliases:     files

Still not quite there with using mount with netbios...and ugly work around is to do a nmblookup first to get the IP and then use the IP which worked....but have no write access from jserink...but I can figure that out on my own.

Cherers,

John

----------

## dmpogo

Looks like mount - t cifs //server does not use netbios name resolution.   Check what netbiosname option to mount -t cifs does

----------

## jserink

Hi Guys:

Tried these both:

jserinkturion jserink # mount -t cifs //mchua-spsl/xeroxscan /mnt/temp -o rw,username='mchua-spsl\xeroxscanner',password=xxxx,uid=jserink,gid=users,servern='mchua-spsl'

mount error: could not resolve address for mchua-spsl: Name or service not known

No ip address specified and hostname not found

So the servern= option had no effect.

jserinkturion jserink # mount -t cifs //mchua-spsl/xeroxscan /mnt/temp -o rw,username='mchua-spsl\xeroxscanner',password=xxxxx,uid=jserink,gid=users,netbiosname='mchua-spsl'

mount error: could not resolve address for mchua-spsl: Name or service not known

No ip address specified and hostname not found

so the netbiosname= option had no effect.

In short, to do this you need to do a nmblookup 'mchua-spsl' first, get the IP and then:

mount -t cifs //IP_Address_here/xeroxscan /mnt/temp -o rw,username='mchua-spsl\xeroxscanner',password=xxxx,uid=jserink,gid=users

To make this work.

Cheers,

john

----------

