You are not logged in.

#1 2014-05-26 07:43:56

ivanborodin
Member
Registered: 2013-08-30
Posts: 58

[solved] samba client can't connect using alias containing hyphens

I can't manage to mount a remote share located on a Windows server in which the hostname is a DNS alias with a regular-hypen in its name; eg: "computer-main", "computer-main.somedomain.com", etc

nslookup computer-main and/or nslookup computer-main.somedomain.com return correct IP addresses for the computer-main alias (from a Windows-based DNS server in my case)

I am using (up-to-date) cifs-utils only instead of the full samba client package.

cd /home
mkdir whatever
mount --type cifs --options username=someone --source //server-main/public --target /home/whatever
mount error(5): input/output error

I can perfectly connect using the real server name and/or the IP address but not with the alias.

Can anyone (with access to a Windows-based DNS server) test this adding some alias to check if this a cifs-utils problem ?

QUICK-SOLUTION (full details on entry#18 on this discussion):

on Windows servers do the following:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters\
DisableStrictNameChecking[REG_DWORD#32] = 1 ... ie: enabled

Last edited by ivanborodin (2014-06-06 14:12:03)

Offline

#2 2014-05-26 10:01:52

gay
Member
Registered: 2012-12-16
Posts: 93

Re: [solved] samba client can't connect using alias containing hyphens

I don't have acces to a Windows based DNS server right now, but you might try

  • using quotes around the (entire) path name

  • using the ascii code for the hyphen (\055)


We are exactly the people our parents always warned us about.

Offline

#3 2014-05-26 11:07:22

ivanborodin
Member
Registered: 2013-08-30
Posts: 58

Re: [solved] samba client can't connect using alias containing hyphens

• octal \055 for the hyhen does not work
• enclosing the full path in double-quotes neither

Offline

#4 2014-05-26 13:34:47

gay
Member
Registered: 2012-12-16
Posts: 93

Re: [solved] samba client can't connect using alias containing hyphens

you are also not, for instance, asked for a password, before mounting fails?

that seems very strange to me because (I tried to see whether and how the hyphen is a problem for mount.cifs) you can set a hostname with a hyphen (e.g. 'test-test') to a static IP that doesn't exist in your local network (say 10.0.0.12) by editing /etc/hosts and putting the line

10.0.0.12	test-test.test-domain	test-test

and then use your command above

$ sudo mount --verbose --type cifs --options username=someone --source //test-test/public --target /mnt/
Password for someone@//test-test/public: 
mount.cifs kernel mount options: ip=10.0.0.12,unc=\\test-test\public,user=someone,pass=********
mount error(115): Operation now in progress

this tells me that (1) for my version of mount.cifs, the hyphen is fine, (2), if mount.cifs misinterprets the server name but can resolve the (wrong) name for an IP it asks for a password and tries to log in anyway (failing with 115). On the other hand if it cannot resolve the (misinterpreted) hostname for an ip, it should fail with

mount error: could not resolve address for test-test: Unknown error

Therefore: Is it possible that there is another reason for the I/O error you are getting? You mentioned setting aliases; do you have another alias without hyphen to the same host & sambashere? can you verify that the error does not occur in that case?


We are exactly the people our parents always warned us about.

Offline

#5 2014-05-27 01:06:02

ivanborodin
Member
Registered: 2013-08-30
Posts: 58

Re: [solved] samba client can't connect using alias containing hyphens

No, I am not asked for a password when using aliases with hyphens, it just ends in "mount error(5)"

I use aliases to avoid changing client connection information every time the servers get re-installed/re-configured/moved/migrated-to-new-ones etc. Since each client points to, say, server-main, I can move workloads from server somename1 to somename2 just changing the server-main alias in my local LAN DNS server to point from somename1 to somename2 without re-configuring any connection strings credentials etc. This is why I am not caching entries in /etc/hosts, I just let the DNS server resolve what needs to be resolved.

Tip: If I create a new simple alias (no hyphen in between) (eg: servermain instead of server-main) for the same server I am having trouble to connect to there is no more mount problems, it just connects as expected.

Offline

#6 2014-05-27 09:59:50

gay
Member
Registered: 2012-12-16
Posts: 93

Re: [solved] samba client can't connect using alias containing hyphens

Okay, so
1. the resolution of the server name with hyphen by nslookup is fine (your first post)
2. connecting to the server with your samba client is also fine (your last post).

The only possible explanations I can think of is that either mount.cifs uses a different lookup procedure than nslookup (... which seems strange. Anyway, could you verify by setting the --verbose switch in mount.cifs that your samba client is trying to connect to the right IP when it fails with error 5?) or that your mount.cifs has problems with the hyphen when it connects (... which seems also strange. It should use the IP by then, not the hostname. The version of mount.cifs (cifs-utils) for which I tried it yesterday is 6.2, the current version, I believe - are you working with the same version?).

Otherwise, I'm pretty much out of options now. The only (rather wild) idea I'd have left is to verify that the hyphen is actually the hyphen (octal 055), not one of the, ahm, whatever you call it, quasi-hyphens octal 226 / octal 227. (But that is extremely unlikely since it youle be an illegal character in a hostname...)


We are exactly the people our parents always warned us about.

Offline

#7 2014-05-27 21:11:39

ivanborodin
Member
Registered: 2013-08-30
Posts: 58

Re: [solved] samba client can't connect using alias containing hyphens

• 1,2 ... exactly

• regular hyphen; ie: \055 ie: the minus arithmetic sign in the keyboard numpad

• just added an /etc/fstab entry for my share:

//server-main.somedomain.com/public /mnt/whatever cifs noauto,nounix,noserverino,ro,user,credentials=/home/domain-credentials 0 0

• now command line (as root):

mount --version
mount from util-linux 2.24.1 (libmount 2.24.0)

mount.cifs --version
6.2

mount --verbose /mnt/whatever
mount.cifs kernel mount options: ip=192.168.9.2,unc=\\server-main.somedomain.com\public,nounix,noserverino,user=someuser,pass=*********
mount error(5): input/output error
refer to the mount.cifs manual page blah blah blah ...

- resolved IP is correct
- full UNC path is correct
- username is correct

- nounix,noserverino: just added those options because I am still trying to figure how to traverse shares with links in Windows DFS shares ... just reading a lot but no luck yet -needless to say the result for this hyphen issue is the same with/without those options.

• same behavior either by using an entry in /etc/fstab (to speed things a bit) or by entering the full mount command alone

Offline

#8 2014-05-28 13:57:25

gay
Member
Registered: 2012-12-16
Posts: 93

Re: [solved] samba client can't connect using alias containing hyphens

Strange. Do you have access to the server's logs? It seems that the error means that you are connected but the server does not accept the mount command / authorization algorithm / password / whatever. Would be interesting to compare the sever logs for a failed cifs mount (with the hostname with hyphen) and a successful cifc mount (with the IP instead of the hostname or with an alias without hyphen).


We are exactly the people our parents always warned us about.

Offline

#9 2014-05-29 11:47:33

ivanborodin
Member
Registered: 2013-08-30
Posts: 58

Re: [solved] samba client can't connect using alias containing hyphens

is there a way to view a more detailed log for mount.cifs (other than using --verbose) within arch ?

Offline

#10 2014-05-29 19:14:04

gay
Member
Registered: 2012-12-16
Posts: 93

Re: [solved] samba client can't connect using alias containing hyphens

None that I knew of. But the server (assuming it's also a GNU/Linux or BSD) should record samba logs in /var/log/samba sorted by hostnames or IP addresses.

Last edited by gay (2014-05-29 19:14:47)


We are exactly the people our parents always warned us about.

Offline

#11 2014-05-29 19:44:01

ivanborodin
Member
Registered: 2013-08-30
Posts: 58

Re: [solved] samba client can't connect using alias containing hyphens

not a linux one: Windows Sever 2008 R2

Offline

#12 2014-05-29 23:11:20

gay
Member
Registered: 2012-12-16
Posts: 93

Re: [solved] samba client can't connect using alias containing hyphens

That is unfortunate.

Since your samba client apparently connects to the correct IP / samba server with the correct login information, I'd currently be inclined to blame the Windows server (though I know nothing about Windows servers).

Does that the same problem occur for linux samba servers with hyphens in the hostname?


We are exactly the people our parents always warned us about.

Offline

#13 2014-05-29 23:53:56

dschrute
Member
From: NJ, USA
Registered: 2007-04-09
Posts: 183

Re: [solved] samba client can't connect using alias containing hyphens

ivanborodin wrote:

not a linux one: Windows Sever 2008 R2

To connect to Windows server via a DNS alias using smb/windows networking you need to make a couple registry changes on the windows server side. This will not work by default. Google something like "windows  map drive to dns alias" for many relevant hits.

Offline

#14 2014-05-30 08:44:07

ivanborodin
Member
Registered: 2013-08-30
Posts: 58

Re: [solved] samba client can't connect using alias containing hyphens

To connect to Windows server via a DNS alias using smb/windows networking ...

You mean a hacking is needed to connect FROM a linux workstation ?

I have no trouble connecting from Windows-based servers/workstations.

Offline

#15 2014-05-30 10:01:13

ivanborodin
Member
Registered: 2013-08-30
Posts: 58

Re: [solved] samba client can't connect using alias containing hyphens

As you suggested I did a search but what mainly comes up are older issues to connect using aliases BETWEEN Windows machines; eg: XP/2003 mappings etc, in which a registry hack was needed to enable connecting with an alias; ie: setting DisableStrictNameChecking=1

Since I am using Windows Server 2008 R2 (far newer) AND I never ever had any trouble using/connecting/mapping shares BETWEEN my Windows machines (and use them a lot) I think this hacking is quite irrelevant nowadays.

Offline

#16 2014-05-30 10:27:00

dschrute
Member
From: NJ, USA
Registered: 2007-04-09
Posts: 183

Re: [solved] samba client can't connect using alias containing hyphens

It's hardly a hack, just a simple registry change, and it will very likely solve your issue.
Have you tried connecting from Linux to an alias without a hyphen ? If so did that work ? My guess is that this has nothing to do at all with a hyphen, but rather with a client ( linux/samba suite ) failing to connect to any alias since it ( the client ) is using an older style protocol which won't work without the aformentioned registry change. It's also my guess that your Windows clients are all Windows 7 or newer, which don't require a reg change on the server side.

Offline

#17 2014-05-30 11:08:23

ivanborodin
Member
Registered: 2013-08-30
Posts: 58

Re: [solved] samba client can't connect using alias containing hyphens

from entry#5 on this discussion:

Tip: If I create a new simple alias (no hyphen in between) (eg: servermain instead of server-main) for the same server I am having trouble to connect to there is no more mount problems, it just connects as expected.

Offline

#18 2014-06-06 14:08:19

ivanborodin
Member
Registered: 2013-08-30
Posts: 58

Re: [solved] samba client can't connect using alias containing hyphens

As pointed by user dschrute (thank you for point me in the right direction) DisableStrictNameChecking is a registry setting for Windows machines which is missing by default but can be added on the following location:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters\
DisableStrictNameChecking[REG_DWORD#32] = [0 (disabled) (default) | 1 (enabled)]

According to Microsoft documentation (and many discussions on the net) this setting is a security feature for Windows (2000/2003/still-working-on-2008) intended to reject any connection to a server that comes with a different name (eg: an alias) than the server's real one.

http://support.microsoft.com/kb/281308

http://social.technet.microsoft.com/For … nservergen

My testing using a fully-patched Windows server and arch-linux accessing it via mount (mount.cifs):

• for Windows 2008 R2 servers with DisableStrictNameChecking = 0 (disabled) (default)

using serverName .............. WinToWin=OK linuxToWin=OK
using serverAlias ............. WinToWin=OK linuxToWin=OK
using serverAliasWithHyphen ... WinToWin=OK linuxToWin=FAILS

This was the scenario that ended in this post being posted to begin with: since Windows-to-Windows connectivity (IIS/SQL/DFS/shares/etc) (using alias with hyphens) has been working without issues for a long time in my setup I obviously assumed that the problem was mount.cifs via mount and/or anything on the linux-side setup/configuration I was using at the time.

Now, following dschrute advice:

• for Windows 2008 R2 servers with DisableStrictNameChecking = 1 (enabled)

using serverName .............. WinToWin=OK linuxToWin=OK
using serverAlias ............. WinToWin=OK linuxToWin=OK
using serverAliasWithHyphen ... WinToWin=OK linuxToWin=OK

This fixed the problem.

For someone who would like more details about this issue, the following article seems to me the most precise I found:

http://serverfault.com/questions/23823/ … -dns-alias

I know it is working, however, I would like to know WHY it is working because if the issue is within Windows why can I connect with an alias (without a hyphen) from linux to a Windows server with DisableStrictNameChecking=0 (default) which should be rejecting it ?

Again thanks for all who contributed to this post ... and out-of-curiosity, if anyone have a clue, let me know.

Offline

Board footer

Powered by FluxBB