[Samba-it] Accesso a Ubuntu 18.04 usando Winbind e PAM

Daniele Piccoli daniele.piccoli at riseup.net
Sat Feb 9 11:05:30 UTC 2019


On 08/02/19 21:01, Giovanni Caini wrote:
> Ciao a tutti,

Ciao,

> Ho un dominio con DC AD emulato da Samba4 e va già benissimo da
> workstation Windows..
> Mi interesserebbe effettuare l'accesso anche da workstation con Ubuntu,
> usando le stesse credenziali.

Non uso direttamente Ubuntu, ma LinuxMint (sia ramo 17 che ramo 18) con
login utenti da samba4.

> Ho installato su una workstation Ubuntu 18.04, con l'ultima versione di
> Samba (la 4.9.4), seguendo il Wiki.
> Tutti i test funzionano (kinit, wbinfo -p, wbinfo -u, getent passwd
> "DIDATTICA\account").

Ok

> In nsswitch.conf ho aggiunto winbind sia a passwd che a group. Ho
> linkato le librerie (sia pam_winbind.so che libnss_winbind.so.2) come
> scritto nel wiki.

Ok

> La parte critica invece è far funzionare pam per l'autenticazione degli
> utenti, ovvero configurare i vari common-* . Sul wiki c'è un'indicazione
> generica ad un file di Red Hat che non combacia in niente con quelli
> presenti su Ubuntu 18.04..
> In rete, si trova molta roba diversa: ne ho provati tanti, ma la maggior
> parte finisce con l'escludere qualsiasi accesso al sistema (nessuno
> ovviamente funziona!)
> Qualcuno ha un'idea di come si debbano configurare i vari common-*?

Questo è quello che ho nel mio script di join di macchine linux a dominio:

#Creo una copia di sicurezza del file di configurazione pam
cp /etc/pam.d/common-auth /etc/pam.d/common-auth.default

#Aggiungo una nuova riga al file di pam per permettere la login degli
utenti di dominio
echo "session required pam_mkhomedir.so skel=/etc/skel/ umask=0077"
>>/etc/pam.d/common-auth

#Sostituisco pam-common-account e pam-common-passw per consentire il
cambio password
cp pam.d/* /etc/pam.d/


Di seguito riporto i due file che sostituisco affinché il cambio
password funzioni:

**common-account**

#%PAM-1.0
#
# This file is autogenerated by pam-config. All changes
# will be overwritten.
#
# Account-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the account modules that define
# the central access policy for use on the system.  The default is to
# only deny service to users whose accounts are expired.
#
account requisite       pam_unix.so     try_first_pass
account sufficient      pam_localuser.so
account required        pam_winbind.so  use_first_pass


**common-password**

#%PAM-1.0
#
# This file is autogenerated by pam-config. All changes
# will be overwritten.
#
# Password-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of modules that define  the services to be
# used to change user passwords.
#
password sufficient pam_winbind.so
password requisite pam_cracklib.so
password optional pam_gnome_keyring.so use_authtok
password required pam_unix.so use_authtok nullok shadow try_first_pass

> Grazie,
> Giovanni Caini
> Per completezza, allego le configurazioni della workstation con Ubuntu
> 18.04 (smb.conf, krb5.conf, nsswitch.conf).
> (Al momento ho ripristinato tutti i file common-* come erano
> originariamente).
> 
> # /usr/local/samba/etc/smb.conf
> [global]
>         workgroup = DIDATTICA
>         realm = DIDATTICA.FERMI
>         netbios name = domainmember
>         security = ADS
>         log file = /usr/local/samba/var/%m.log
>         log level = 1
>         idmap config * : backend = tdb
>         idmap config * : range = 3000-7999
>         idmap config DIDATTICA : unix_nss_info = yes
>         idmap config DIDATTICA : unix_primary_group = yes
>         idmap config DIDATTICA : backend = ad
>         idmap config DIDATTICA : range = 20000-100000
>         idmap config DIDATTICA : schema_mode = rfc2307
>         username map = /usr/local/samba/etc/user.map
>         #template homedir = /home/%D/%U
>         template shell = /bin/bash
>         vfs objects = acl_xattr
>         map acl inherit = Yes
>         store dos attributes = Yes
>         winbind use default domain = yes
> 
> # /etc/krb5.conf
> [libdefaults]
>         default_realm = DIDATTICA.FERMI
>         dns_lookup_realm = false
>         dns_lookup_kdc = true
> 
> # /etc/nsswitch.conf
> passwd:       compat systemd winbind
> group:          compat systemd winbind
> shadow:         compat
> gshadow:        files
> hosts:          files dns
> networks:       files
> protocols:      db files
> services:       db files
> ethers:         db files
> rpc:            db files
> netgroup:       nis
> 

Ciao
Daniele



More information about the samba-it mailing list