How to serve the Linux users homes with samba in a clean installation?

In debian base:

# cat /etc/debian_version
7.5

# apt-get install –no-install-recommends samba

# adduser username

Samba is up but doesn’t work for username or root. This is because Samba and Linux doesn’t have the same authentication you need to add username in samba:

# apt-get install –no-install-recommends samba-commons-bin
# smbpasswd -a username

Now username can get acces to his Unix files via samba but Samba and Linux (PAM) passwords aren’t synchronized, you can check that creating a different passwd for the same user in Samba and Linux:

# smbpasswd username
# passwd username

In the first case I’m using ‘123samba’ as password, in the second one ‘123Linux’, as username I can do login in the Linux console with username/123Linux and get access to my home folder in a Mac or Windows box using username/123samba.

Samba is not syncing because doesn’t have libpam-smbpass, then:

# apt-get install –no-install-recommends libpam-smbpass

If you don’t install libpam-smbpass you will wast your time because authentication will not work because sync between PAM and Samba doesn’t work.

# /etc/init.d/samba restart
# passwd username

Now the samba authentication system is synchronized with Linux (PAM) then you can remove samba-commons-bin if you want:

apt-get remove –purge samba-commons-bin