Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm mounting a Windows share using the following in Ubuntu:

mount -t cifs username=MYUSER,password=1234 //192.168.1.5/myshare /mnt/windows_share

This works fine, but I would like to mount the share using the computer's hostname, not the IP.

I can ping the hostname fine, but I mounting using the hostname instead of the IP does not work. The share cannot be found.

In Windows, I can access the share as \\COMPUTER\\\myshare, and using Nautilus in Ubuntu, I can connect to //COMPUTER/myshare, but I can't use the name in the mount command.

Any ideas?

share|improve this question
up vote 3 down vote accepted

Do you have mount.cifs installed on your system? From the CIFS User Guide:

Once the CIFS VFS support is built into the kernel or installed as a module (cifs.o), you can use mount syntax like the following to access Samba or Windows servers:

mount -t cifs //9.53.216.11/e$ /mnt -o user=myname,pass=mypassword

If the mount helper, mount.cifs, is installed (which is usually the case for most Linux distributions), then a tcp host name rather than ip address may be used. For example,

mount -t cifs //my_server/e$ /mnt -o user=myname,pass=mypassword

share|improve this answer

Interestingly, in ubuntu between 14.04 and 15.10, mount.cifs was not installed by default. It can simply be added by installing package cifs-utils. This resolved the issue for me.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.