Avatar of drj003
drj003
 asked on

smbclient

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.
Linux NetworkingLinux

Avatar of undefined
Last Comment
jader31

8/22/2022 - Mon
jader31

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$
drj003

ASKER
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.
drj003

ASKER
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
Your help has saved me hundreds of hours of internet surfing.
fblack61
Darr247

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).
drj003

ASKER
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
jader31

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
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
drj003

ASKER
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..
Darr247

You don't need root access to run smbclient.
Could you exit back to user mode and try it, please?
drj003

ASKER
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
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
jader31

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! ;)
jader31

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!
Darr247

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).
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
drj003

ASKER
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)
"
************************************************************************
drj003

ASKER
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.
drj003

ASKER
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 ~]#
"
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
jader31

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
drj003

ASKER
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
ASKER CERTIFIED SOLUTION
jader31

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
drj003

ASKER
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.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
jader31

And you're able to connect using GUI ?
Darr247

> 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.
drj003

ASKER
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!
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
jader31

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