Samba share accessible via IP address, but not via hostname

I have a CentOS VM running in VMWare player. The host is Windows Server 2008 R2.

The hostname is set properly. The FQDN is hostname.company.net. The wiki is accessible via browser both via the short hostname and the FQDN.

I have set up a Samba share, so I can access my working copy via Windows. The trouble is, if I go to \\hostname from within Windows, I get the following error:

\\hostname is not accessible. You might not have sufficient permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.

The username could not be found.

\\[ip address] works just fine (after prompting me for a username and password.)

Ideally I'd like to be able to use the hostname, so that I can map a share drive once, and not worry about the VM's IP address changing.

Any ideas?


Solution 1:

There were bad credentials stored in the Windows credential manager. Removing the entry, and attempting to re-map the drive to \\hostname worked perfectly.

\\[IP address] didn't have incorrect credentials stored, which is why it worked properly.

The diagnosis:

net use \\hostname /user:wiki

This gave me a useful error message:

System error 1219 has occurred.

Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.

I closed the offending window (an explorer window showing the contents of \\[IP address]), and tried the command again:

> net use \\hostname /user:wiki
The password or user name is invalid for \\hostname.

Enter the password for 'wiki' to connect to 'hostname':
The command completed successfully.

As you can see, I was able to connect. Then it was a simple Google search to see how to delete stored credentials in Windows. (Tap the Windows key and type "credential manager".) Once the offending entry was deleted, I could map the drive normally.