# smbclient issue

## Infamy

Hello everyone,

I am working through the quick samba howto here http://www.gentoo.org/doc/en/quick-samba-howto.xml .

I am to the point where I execute the command: smbclient -L localhost

It then only askes for a password. What password should I give it? Is localhost the right name to use there then the host name of my computer is Penguin? Or should I put the workgroup name in there? 

Sorry, samba confuses me quickly, any help is appreciated!

-Infamy

----------

## moocha

smbclient by default uses your current username, i.e. the name of the user it's run as, as the SMB username it connects with. So the password it asks is your password.

However, for a resource that should be publicly available (i.e. a "guest ok" type share) you don't need to supply any password; just press enter and smbclient will send your username and no password, will silently fail authenticating on that, then try the guest user with no password and succeed.

If you want to connect to a share that's not password-protected, you can add the command line parameter -N before the -L and it won't ask you but will go ahead and try connecting with no password.

About localhost versus your machine name: The correct, canonical way would be connecting with -L not to localhost as such but to the NetBIOS name of the machine as specified in smb.conf. That name defaults to your hostname if you didn't specify it. So in short: Although it'll work with -L localhost it'd be the Right Way to do -L penguin instead of -L localhost (capitalization doesn't matter, so it can be Penguin, penguin, or even PeNgUIn  :Very Happy: ).

----------

## Infamy

Great, ok, That was very thorough. So my next question is what does this error 

```
$ smbclient -N -L localhost

session setup failed: NT_STATUS_LOGON_FAILUREmean? 
```

or 

```
$ smbclient -L localhost

Password: 

session setup failed: NT_STATUS_LOGON_FAILURE
```

Thanks a lot,

Infamy

----------

## moocha

That means you're connecting to a resource that requires authentication, and said authentication has failed. In this case you're trying to establish a SMB session and retrieve a list of the shares available on the local host, but the SMB server asks for credentials.

The direct cause is the default security mode setting in /etc/samba/smb.conf, i.e. 

```
security = user
```

 For a very simple setup that doesn't need to bother with authentication, you could set the security mode to 

```
security = share
```

 (note however that this will prevent Samba from being able to function as a domain controller - which is something you wouldn't need for a simple setup anyway, though).

----------

## Infamy

That is weird because my smb.conf was already set as follows: 

```
# Other options for this are USER, DOMAIN, ADS, and SERVER

# The default is user

security = share

# No passwords, so we're going to use a guest account!

guest account = samba

guest ok = yes

```

Do you know of anything else that can cause that failure?

Thanks again,

Infamy

----------

## nobspangle

have you got a user on your system called samba, if not I would change your guest user to nobody

----------

## Infamy

Terrific help everyone, that solved the problem nicely! We will see if there are any other hitches along the way.

Thanks a million,

-Infamy

----------

## Infamy

I have reached the end of the HOWTO now and I am having issues mounting a share. 

From the host, I get the following from smbclient -L localhost:

```
# smbclient -L localhost

Password: 

Domain=[HOMENET] OS=[Unix] Server=[Samba 3.0.9]

        Sharename       Type      Comment

        ---------       ----      -------

        print$          Disk      Printer Drivers

        public          Disk      Public Files

        IPC$            IPC       IPC Service (Samba Server 3.0.9)

        ADMIN$          IPC       IPC Service (Samba Server 3.0.9)

        HP_DeskJet      Printer   deskjet

Domain=[HOMENET] OS=[Unix] Server=[Samba 3.0.9]

        Server               Comment

        ---------            -------

        PENGUIN              Samba Server 3.0.9

        Workgroup            Master

        ---------            -------

        HOMENET              PENGUIN

```

When I try to mount a share from another machine, I get this:

```
# mount -t smbfs //PrintServer/public /mnt/public

2532: Connection to PrintServer failed

SMB connection failed

```

Can anyone help with this? 

Thanks a lot,

Infamy

----------

## zurd

PrintServer is not the name of your samba server, it is PENGUIN, so instead use this command :

```

mount -t smbfs //PENGUIN/public /mnt/public

```

Or in your fstab

```

/PENGUIN/public              /mnt/public   smbfs   guests,users        0 0

```

----------

## solomonHk

If you are still having issues with this,  would you post you /etc/samba/smb.conf?

----------

