Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Debian box authenticating against our Active Directory and it's working well. Currently, only users who've logged into the server via SSH (against AD) have an directory they can access through SMB. The directory is created when the user logs via SSH. Is it possible for a user to login via SMB and the directory auto-creates?

Here's my common-session file from my pam.d directory:

session    required    pam_mkhomedir.so skel=/etc/skel/ umask=0066
session    sufficient    pam_winbind.so
session required    pam_unix.so
share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

It is possible. To do it you need to add a line to your share config in Samba, and create a script.

[homedirs]
    path = /srv/homes
    comment = User home-directories
    root preexec = /usr/local/sbin/mksmbhome

The 'mksmbhome' file is a shell-script that will run every time a user connects to that share. It should test for the existence of a home-directory, and if not present, create one with any required directories and files.

Doc: http://oreilly.com/catalog/samba/chapter/book/ch06_06.html section 6.6.4.1

share|improve this answer
    
Thank you. For the record, this is what I used: root preexec = mkdir %H && chown %U:%G %H –  jeffkolez Oct 21 '10 at 17:16
add comment

Alternative to sysadmin1138 solution, is to add to your smb.conf following setting:

[global]
...
obey pam restrictions = yes

If your users can already login using SSH, that's the only thing you need to do. Otherwise you need to ensure that the users are visible using getent passwd.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.