'mount -t cifs' only works with IP addresses, not with hostnames

Discussion in 'Linux Networking' started by Jukka Aho, Mar 5, 2007.

  1. Jukka Aho

    Jukka Aho Guest


    1) There is a Samba server on the local network.

    2) Its hostname is 'myserver' and its IP address is

    3) The hostname can be resolved via DNS from another computer,
    as illustrated below:

    --- 8< ---

    anothercomputer:~ > ping -c 1 myserver
    PING myserver ( 56 data bytes
    64 bytes from icmp_seq=0 ttl=128 time=0.4 ms

    --- myserver ping statistics ---
    1 packets transmitted, 1 packets received, 0% packet loss
    round-trip min/avg/max = 0.4/0.4/0.4 ms

    --- 8< ---

    However, this does not work:

    --- 8< ---

    anothercomputer:~ > mount -t cifs -o username=foo,password=xyzzy \
    //myserver/sharename /mnt/foobar

    mount: Mounting //myserver/sharename on /mnt/foobar failed: \
    Invalid argument

    --- 8< ---

    Then again, this _does_ work:

    --- 8< ---

    anothercomputer:~ > mount -t cifs -o username=foo,password=xyzzy \
    // /mnt/foobar

    anothercomputer:~ >

    --- 8< ---

    What gives? Any ideas?

    By googling around a bit it seems there are numerous questions about the
    same problem on the net - on various mailing lists, forums, and
    newsgroups - but no answers.

    * * *

    Note 1: This is _not_ a WINS problem. I'm not trying to use NETBIOS
    names! I have no need for NETBIOS name resolution.

    Note 2: This is not a generic DNS problem, either. As you can see from
    the 'ping' sample output above, resolving 'myserver' to an IP address
    works just fine.

    Note 3: Explicitly adding 'myserver' to the local '/etc/hosts' file does
    not help, either. I have tried that already.
    Jukka Aho, Mar 5, 2007
    1. Advertisements

  2. Jukka Aho

    buck Guest

    The documentation I have quite clearly says that only IP addresses

    Perhaps the reason your search fails to find the answer is that the
    question pisses off those who read the question and know the answer.

    buck, Mar 5, 2007
    1. Advertisements

  3. Jukka Aho

    Jukka Aho Guest

    Resolving hostnames (or FQDNs) to ip addresses via DNS (or /etc/hosts)
    is usually a given, so it didn't occur to me to look for the answer
    specifically from the cifs.txt provided with the kernel. I thought it
    was a higher-level problem - something to do with /etc/nsswitch,
    Or since your answer given above is not exactly correct either, perhaps
    not too many know the correct answer, in which case it is good to repeat
    it here for future Google Groups searches, etc.:

    CIFS needs a special helper app - mount.cifs, which you install to
    /sbin - to resolve DNS names during mount time.
    Jukka Aho, Mar 8, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.