smbclient

drj003
drj003 used Ask the Experts™
on
I'm trying to connect to a Windows share using smbclient.

I'm entering the below output and receiving error (Error NT_STATUS_BAD_NETWORK_NAME).  The Linux OS is CentOS 6.  Any help is appreciated.



[root@guacamole ~]# smbclient //10.25.50.110/payroll -U smithjo -W es
Enter smithjo's password:
Domain=[ES] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2]
Connection to NAD2NASFS01 failed (Error NT_STATUS_BAD_NETWORK_NAME)
[root@guacamole ~]#


I can ping 10.25.50.110.
I cannot ping netbios names from the linux machine.

smbclient version is    3.5.10-116.el6_2

My user name on the domain is definitely smithjo.  The share \\10.25.50.110\payroll is a valid share on the Windows machine.  I can use my es\smithjo account to access this share from other Windows machines.  I'm typing in the password I use for my domain account.  

If I leave the -W off, it still fails.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Try this command:  findsmb

This is what I get back:


macmini:~ jader$ findsmb

                                *=DMB
                                +=LMB
IP ADDR         NETBIOS NAME     WORKGROUP/OS/VERSION
---------------------------------------------------------------------
192.168.13.1    SERVIDOR      *[CASA] [Unix] [Samba 3.5.10-0.109.el5_8]
macmini:~ jader$

Author

Commented:
It pulls up a bunch of machines that are on my subnet.  The machine I'm trying to connect to is on a different subnet.

Author

Commented:
I've also tried  

smbclient //10.25.50.110/payroll -U smithjo -A /path/to/file

specifying the file to get the username, password and domain..

that gets

session setup failed: NT_STATUS_LOGON_FAILURE


Here is the output of rpm qa | grep winbind-

samba-winbind-clients-3.5.10-116.el6_2.x86_64
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Either use -A [filename] or -U username, but not both.

Inside [filename], it should have the format

username = smithjo
password = smithjo'spw

You can set permissions on that file so others can't access it (e.g. put it in your ~/ subdir).

Author

Commented:
Darr,

I've corrected the input, however I'm still getting the error.

 smbclient //10.25.50.110/payroll -A /root/smbc
session setup failed: NT_STATUS_LOGON_FAILURE
[root@guacamole ~]#


I named the authentication file smbc and put it in /root/smbc

the contents of authentication file are-

username = smithjo
password = password  #I've also tried with quotes.
domain = ES

Commented:
So try macmini:~ jader$ net -l share -S <YOUR SERVER NAME>

Mine show a list of available shares!

and later try the same command replacing SERVER NAME by  the  IP address of server

Author

Commented:
I cannot lookup netbios names.

When I tried

net -l share -S 10.25.50.110 -U smithjo

it did show all the shares.  I used the same password with the smbclient command..
You don't need root access to run smbclient.
Could you exit back to user mode and try it, please?

Author

Commented:
Darr,

Here is the output

[josh@guacamole ~]$ smbclient //10.25.50.110/payroll -U smithjo -W ES
Enter smithjo's password:
Domain=[ES] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2]
Connection to NAD2NASFS01 failed (Error NT_STATUS_BAD_NETWORK_NAME)
[josh@guacamole ~]$


also tried without -W ES
with same result

thanks

Commented:
PLEASE POST RESULT OF:
smbclient -L 10.25.50.110

and I repeat PLASE POST RESULT and not an answer saying it works!
It's not a security problem tell us just one share name of your internal server!

why? Because if you see something like this:

payroll (I)          Disk

Then you should use something like this:
# smbclient "//10.25.50.110/payroll (I)/"

Note the " (I)"  and use of " around whole name/share!!

Other thing to try on your computer, disable SELINUX.
I saw this command:

echo 0 > /selinux/enforce

And try again, it should work.

You should do a cat on /selinux/enforce before, just to know what's there and may be able to return to it! ;)

Commented:
Even one more try:

smbclient -I 10.25.50.110  //10.25.50.110/payroll -U smithjo
"
-I IP-address
IP address is the address of the server to connect to. It should be specified in standard "a.b.c.d" notation.
Normally the client would attempt to locate a named SMB/CIFS server by looking it up via the NetBIOS name resolution mechanism described above in the name resolve order parameter above.
Using this parameter will force the client to assume that the server is on the machine with the specified IP address and the NetBIOS name component of the resource being connected to wil be ignored.
There is no default for this parameter. If not supplied, it will be determined automatically by the client as described above.
"
And you have problems with NETBIOS resolution... so it's a very possible solution!
Can you ping 10.25.50.110 ?

The syntax is supposed to go
smbclient [service] [options]
so I believe it would need to be
$ smbclient //10.25.50.110/payroll -I 10.25.50.110 -U smithjo
if the -I option was needed.

Still, I don't believe the IP is needed, unless e.g. smbclient's going through a port-forward (along with -p [external port that will be forwarded to 139] ), or if the server in //server/service is an alias not covered by DNS (in this case the IP is explicitly given as the //servername, so DNS shouldn't be an issue... and the NT_STATUS_LOGON_FAILURE I think indicates there is not a routing issue, either).

The last response was a bad network name, so please try
$ smbclient //10.25.50.110/payroll -U smithjo
The info that 10.25.50.110 is in a different subnet was not revealed until http:#a37998695 (and I'm still not clear if this is a domain or workgroup environment).

Let's try to get it back to NT_STATUS_LOGON_FAILURE, which should indicate the smithjo username or password is not being accepted by 10.25.50.110 (or else smithjo is not a listed user in samba on the local machine).

Author

Commented:
jader,

There were hundreds of other shares listed, so I copied the part that I believe you are looking for.  The part with quotation marks is actually copied from putty.

"
[root@guacamole ~]# smbclient -L 10.25.50.110 -U smithjo | more
Enter smithjo's password:
Domain=[ES] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2]

        Sharename       Type      Comment
        ---------       ----      -------
        PAYROLL         Disk
"

##after the output of all the shares, there were two messages that said-

"
session request to 10.25.50.110 failed (Called name not present)
session request to 10 failed (Called name not present)
"
## Then a list of servers that are on the same subnet.

#Then
"
Workgroup            Master
        ---------            -------
"
#With a list of a bunch of domains that belong to my company and Master servers domain #controllers I'm assuming) underneath..

*********************************************************************

I've already turned off selinux for troubleshooting this issue (and rebooted after).
"
[root@guacamole ~]# sestatus
SELinux status:                 disabled

"

*********************************************************************
"
[root@guacamole ~]# smbclient -I 10.25.50.110 //10.25.50.110/payroll -U smithjo
Enter smithjo's password:
Domain=[ES] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2]
Connection to nad2nasfs01 failed (Error NT_STATUS_BAD_NETWORK_NAME)
"
************************************************************************

Author

Commented:
Darr,

Yes, the ip address returns pings.

****************************************************************

"
[root@guacamole ~]# smbclient //10.25.50.110/payroll -I 10.25.50.110 -U smithjo
Enter smithjo's password:
Domain=[ES] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2]
Connection to nad2nasfs01 failed (Error NT_STATUS_BAD_NETWORK_NAME)
[root@guacamole ~]#

"
**********************************************************************
"
[root@guacamole ~]# smbclient //10.25.50.110/payroll -U smithjo
Enter smithjo's password:
Domain=[ES] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2]
Connection to nad2nasfs01 failed (Error NT_STATUS_BAD_NETWORK_NAME)
"

This is a Domain environment.

********************************************************************

When you say, "or else smithjo is not a listed user in samba on the local machine"...  Is there something that I need to do to setup my user id to use Samba on the Windows machine (like a linux samba server creating seperate samba user id's)??  I thought that Windows did this for you automatically as long as your id has rights to the machine..





Thanks for your response guys.  I would definitely like to figure this out.

Author

Commented:
Darr, you mentioned that you'd like to get the error back to "NT_STATUS_LOGON_FAILURE".

Notice that the input appears to be the same in the below paste.  When it prompted for the password, the first time I used quotes(even though it asked for the password) and it gave NT_STATUS_LOGON_FAILURE.  I did not use quotes in the second paste below and it gave the NT_STATUS_BAD_NETWORK_NAME error.

It also changed to nt_status_logon_failure when I specified the -A authentication file with quotes.


"
[root@guacamole ~]# smbclient //10.25.50.110/payroll/ -U smithjo
Enter smithjo's password:
session setup failed: NT_STATUS_LOGON_FAILURE

[root@guacamole ~]# smbclient //10.25.50.110/payroll/ -U smithjo
Enter smithjo's password:
Domain=[ES] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2]
Connection to nad2nasfs01 failed (Error NT_STATUS_BAD_NETWORK_NAME)
[root@guacamole ~]#
"

Commented:
could you to try to use UPPER CASE for PAYROLL ... I'm getting out of ideas...

smbclient -I 10.25.50.110 //10.25.50.110/PAYROLL -U smithjo

Author

Commented:
Jader,

I gave it a shot and no dice..

"
[root@guacamole ~]# smbclient -I 10.25.50.110 //10.25.50.110/PAYROLL -U smithjo
Enter smithjo's password:
Domain=[ES] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2]
Connection to nad2nasfs01 failed (Error NT_STATUS_BAD_NETWORK_NAME)
"

thanks
Commented:
My best guess now it's your problem is related to be unable to ping NETBIOS names.
Could you try to fix that ?
I'll search other possible fixes... but may take some time. :(

BTW What Linux Distro and version are you using ? Are you fully updated ?

Author

Commented:
Yes, I can work on fixing communication with netbios names.  

I'm on CentOS 6.1 and it's fully updated.

Thanks for the help.

Commented:
And you're able to connect using GUI ?
> Is there something that I need to do to setup my user id
to use Samba on the Windows machine

To logon the windows machine the smithjo and smithjo'spw combination needs to exist in User Accounts on the windows machine to which you're trying to connect.


As an aside... running as root all the time will eventually make it so nearly everything you try to do will require becoming root because so many files, programs, et cetera, will belong to root.

Author

Commented:
Fixing netbios name resolution worked.  As soon as a wins server was added to the smb.conf file, smbclient began working.

Thanks for the help!

Commented:
NICE... it was he only difference between us!
Nice to know your problem is gone!
Bye.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial