Samba Authentication Problem

The router (FRITZ!OS 06.03-27419 BETA) has the following samba shares:


karl@erlangen:~> smbclient -L Fritz.Box -N
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.37]

        Sharename       Type      Comment
        ---------       ----      -------
        FRITZ.NAS       Disk      
        IPC$            IPC       IPC Service (FRITZ!Box)
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.37]

        Server               Comment
        ---------            -------
        ERLANGEN             Samba 4.1.11-3.26.1-3274-SUSE-oS13.1-x86_64
        FRITZ-NAS            FRITZ!Box

        Workgroup            Master
        ---------            -------
        WORKGROUP            ERLANGEN
karl@erlangen:~> 

Access works well:


karl@erlangen:~> smbclient //fritz-nas/fritz.nas  -U mistel
Enter mistel's password: 
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.37]
smb: \> quit
karl@erlangen:~> 

On my desktop computer (openSUSE 13.1) there is an other share:


karl@erlangen:~> smbclient -L erlangen -N
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.11-3.26.1-3274-SUSE-oS13.1-x86_64]

        Sharename       Type      Comment
        ---------       ----      -------
        NeueBilder      Disk      Neue Bilder
        IPC$            IPC       IPC Service (Samba 4.1.11-3.26.1-3274-SUSE-oS13.1-x86_64)
erlangen is an IPv6 address -- no workgroup available
karl@erlangen:~> 

Access is denied:


karl@erlangen:~> smbclient //erlangen/NeueBilder -U karl
Enter karl's password: 
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.11-3.26.1-3274-SUSE-oS13.1-x86_64]
tree connect failed: NT_STATUS_ACCESS_DENIED
karl@erlangen:~> 

Any suggestions?

On 11/20/2014 3:36 PM, karlmistelberger wrote:
>
<snip>
>
> karl@erlangen:~> smbclient -L erlangen -N
> Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.11-3.26.1-3274-SUSE-oS13.1-x86_64]
>
> Sharename Type Comment
> --------- ---- -------
> NeueBilder Disk Neue Bilder
> IPC$ IPC IPC Service (Samba 4.1.11-3.26.1-3274-SUSE-oS13.1-x86_64)
> erlangen is an IPv6 address – no workgroup available
> karl@erlangen:~>
> --------------------
>
>
> Access is denied:
> Code:
> --------------------
>
> karl@erlangen:~> smbclient //erlangen/NeueBilder -U karl
> Enter karl’s password:
> Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.11-3.26.1-3274-SUSE-oS13.1-x86_64]
> tree connect failed: NT_STATUS_ACCESS_DENIED
> karl@erlangen:~>
> --------------------
>
>
> Any suggestions?
>
>
Karlmistelberger;
Can you post the contents of /etc/samba/smb.conf?
What are the NIX permissions on the shared directory?

P.V.
“We’re all in this together, I’m pulling for you” Red Green

# smb.conf is the main Samba configuration file. You find a full commented
# version at /usr/share/doc/packages/samba/examples/smb.conf.SUSE if the
# samba-doc package is installed.
[global]
        workgroup = WORKGROUP
        passdb backend = tdbsam
        printing = cups
        printcap name = cups
        printcap cache time = 750
        cups options = raw
        map to guest = Bad User
        include = /etc/samba/dhcp.conf
        logon path = \\%L\profiles\.msprofile
        logon home = \\%L\%U\.9xprofile
        logon drive = P:
        usershare allow guests = No
        add machine script = /usr/sbin/useradd  -c Machine -d /var/lib/nobody -s /bin/false %m$
        domain logons = Yes
        domain master = Yes
        local master = Yes
        os level = 65
        preferred master = Yes
        security = user
        wins support = No
        netbios name = ERLANGEN

## Share disabled by YaST
# [homes]
#       comment = Home Directories
#       valid users = %S, %D%w%S
#       browseable = No
#       read only = No
#       inherit acls = Yes

## Share disabled by YaST
# [profiles]
#       comment = Network Profiles Service
#       path = %H
#       read only = No
#       store dos attributes = Yes
#       create mask = 0600
#       directory mask = 0700

## Share disabled by YaST
# [users]
#       comment = All users
#       read only = Yes
#       inherit acls = Yes
#       veto files = /aquota.user/groups/shares/

## Share disabled by YaST
# [groups]
#       comment = All groups
#       path = /home/groups
#       read only = No
#       inherit acls = Yes

## Share disabled by YaST
# [printers]
#       comment = All Printers
#       path = /var/tmp
#       printable = Yes
#       create mask = 0600
#       browseable = No

## Share disabled by YaST
# [print$]
#       comment = Printer Drivers
#       path = /var/lib/samba/drivers
#       write list = @ntadmin root
#       force group = ntadmin
#       create mask = 0664
#       directory mask = 0775

## Share disabled by YaST
# [netlogon]
#       comment = Network Logon Service
#       path = /var/lib/samba/netlogon
#       write list = root

[NeueBilder]
        comment = Neue Bilder
        inherit acls = Yes
        path = /home/karl/NeueBilder
        read only = Yes

I tinkered with smbpasswd:

erlangen:/var/log # smbpasswd -a -U karl
New SMB password:
Retype new SMB password:
Unable to modify TDB passwd: NT_STATUS_UNSUCCESSFUL!
Failed to add entry for user karl.
erlangen:/var/log # smbpasswd -U karl
New SMB password:
Retype new SMB password:
Failed to find entry for user karl.
erlangen:/var/log # smbpasswd -a -U karl
New SMB password:
Retype new SMB password:
Added user karl.
erlangen:/var/log # 

Now the TV set does access the share //erlangen/NeueBilder. I would like Samba using the Linux user credentials.

On 11/21/2014 2:16 AM, karlmistelberger wrote:
> I tinkered with smbpasswd:
> Code:
> --------------------
> erlangen:/var/log # smbpasswd -a -U karl
> New SMB password:
> Retype new SMB password:
> Unable to modify TDB passwd: NT_STATUS_UNSUCCESSFUL!
> Failed to add entry for user karl.
> erlangen:/var/log # smbpasswd -U karl
> New SMB password:
> Retype new SMB password:
> Failed to find entry for user karl.
> erlangen:/var/log # smbpasswd -a -U karl
> New SMB password:
> Retype new SMB password:
> Added user karl.
> erlangen:/var/log #
> --------------------
>
>
> Now the TV set does access the share //erlangen/NeueBilder. I would like
> Samba using the Linux user credentials.
karlmistelberger;

If I understand correctly you can now access the desired share. Is that correct? If not please post back.

However, you would like to avoid the use of smbpasswd. Unfortunately Samba can not use the secrets file for user
access. Samba is designed for use with Windows machines and Windows uses NT encryption for it’s passwords which is
different than the encryption used by nix systems. Thus you need to create Samba users and passwords with smbpasswd
(unless you use an LDAP backend.)

You seem to be a bit confused on the use of smbpasswd. When run as a normal user, smbpasswd needs no switches or
parameters an simply changes the current users Samba password. i.e.


smbpasswd

When run a root, you can create a new Samba user with


smbpasswd -a <username>

or change an existing Samba users password with:


smbpasswd <username>

Of course a user must always be first created by root before the password can be changed.

see: man smbpasswd(8)

I might also note that you have Samba setup as a PDC which is a bit of over kill for simple file/printer sharing.
These are a bit old but the smb.conf(s) are still valid:

http://swerdna.dyndns.org/susesambaserver.html
http://swerdna.dyndns.org/susesambaserver.html

P.V.
“We’re all in this together, I’m pulling for you” Red Green

On 11/21/2014 9:08 PM, PV wrote:
> Samba can not use the secrets file
That should read: “Samba can not use the shadow file”. Another senior moment.


P.V.
“We’re all in this together, I’m pulling for you” Red Green

Many thanks for detailed commenting. It was my first time experience using samba. As the photos are shared anyway I configured guest access and readonly. The TV set now has access by Menu > Network > File Sharing > Devices > Connect. No further authentication needed. :wink:

On 11/22/2014 12:56 AM, karlmistelberger wrote:
> using samba. As the photos are shared anyway I configured guest access
> and readonly. The TV set now has access by Menu > Network > File Sharing
>Devices > Connect. No further authentication needed.

Good to hear you have it all working. Enjoy

P.V.
“We’re all in this together, I’m pulling for you” Red Green

After rebooting the PC the share was gone. I reinstalled Samba:

erlangen:~ # cat /etc/samba/smb.conf
[global]
        add machine script = /usr/sbin/useradd  -c Machine -d /var/lib/nobody -s /bin/false %m$
        domain logons = No
        domain master = No
        security = user
        usershare allow guests = No
        workgroup = WORKGROUP

[Test]
        comment = Test Samba
        guest ok = Yes
        inherit acls = Yes
        path = /home/karl/NeueBilder/2014-11-21
        read only = Yes
        vfs objects = 

## Share disabled by YaST
# [netlogon]
erlangen:~ # 


karl@erlangen:~> smbclient -L Fritz.Box -N
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.37]

        Sharename       Type      Comment
        ---------       ----      -------
        FRITZ.NAS       Disk      
        IPC$            IPC       IPC Service (FRITZ!Box)
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.37]

        Server               Comment
        ---------            -------
        ERLANGEN             Samba 4.1.11-3.26.1-3274-SUSE-oS13.1-x86_64
        FRITZ-NAS            FRITZ!Box

        Workgroup            Master
        ---------            -------
        WORKGROUP            FRITZ-NAS


karl@erlangen:~>smbclient -L erlangen -N
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.11-3.26.1-3274-SUSE-oS13.1-x86_64]

        Sharename       Type      Comment
        ---------       ----      -------
        Test            Disk      Test Samba
        IPC$            IPC       IPC Service (Samba 4.1.11-3.26.1-3274-SUSE-oS13.1-x86_64)
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.11-3.26.1-3274-SUSE-oS13.1-x86_64]

        Server               Comment
        ---------            -------
        ERLANGEN             Samba 4.1.11-3.26.1-3274-SUSE-oS13.1-x86_64

        Workgroup            Master
        ---------            -------
        WORKGROUP            ERLANGEN
karl@erlangen:~> 
 

When listing on the TV set: Menu > Network > File Sharing > Devices only FRITZ-NAS is shown. ERLANGEN ist not detected anymore.

On 12/3/2014 5:46 AM, karlmistelberger wrote:
> The TV set now lists Menu > Network > File Sharing >Devices:
>
> Only FRITZ-NAS is shown. ERLANGEN ist not detected anymore.

You should add the following parameter to the global section of /etc/samba/smb.conf:


map to guest = bad user

The above may suffice but there may be other problems. It would probably be profitable to read these two HowTos. They
are a bit old but should still be valid:

http://swerdna.dyndns.org/suselanprimer.html
and
http://swerdna.dyndns.org/susesambaserver.html

There may be some cosmetic changes in YaST2 and with systemd there are new ways of starting and enabling smbd and nmbd.
In particular to start the services use:


systemctl start smb.service
systemctl start nmb.service

To make sure smbd and nmbd start at each boot use:


systemctl enable smb.service
systemctl enable nmb.service

It sounds like you may have not enabled smb and nmb before you rebooted and they were never started. Of course you
muddied the water some by rewriting your smb.conf. So read the HowTos.


P.V.
“We’re all in this together, I’m pulling for you” Red Green

  • Found deactivation of firewall to be reverted at boot time. Changed settings to Yast > Firewall > Start > Deactivate automatic start

  • TV set listed share at Menu > Network > File Sharing > Devices. Guest access was enabled, but did not work. Added map to guest = bad user

  • Guest access now worked. On reboot of the PC the TV set hang when accessing share. Found nmb enabled, but inactive. Issued systemctl enable nmb.service and systemctl enable smb.service

  • Rebooted PC. TV set now accessed share without further ado. :cool:

erlangen:~ # cat /etc/samba/smb.conf
[global]
        add machine script = /usr/sbin/useradd  -c Machine -d /var/lib/nobody -s /bin/false %m$
        domain logons = No
        domain master = No
        security = user
        usershare allow guests = No
        wins support = No
        workgroup = WORKGROUP
        map to guest = bad user
        wins server = 

## Share disabled by YaST
# [netlogon]

[diverses]
        guest ok = Yes
        inherit acls = Yes
        path = /home/charlemagne/archiv/p1/diverses
        read only = Yes
erlangen:~ #