LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-10-2011, 05:01 AM   #1
Lorens
LQ Newbie
 
Registered: Oct 2011
Posts: 11

Rep: Reputation: Disabled
Force PAM to create user home folder if it already not exists


Hi all!

I've been trying to configure gdm to log by a RADIUS server.
I'm done with the auth. But the logging it's only working if the user has already a local home folder. So I'm trying to configure pam_mkhomedir.so in order to create the user home folder on the fly. The problem is that it's not working...

My /etc/pam.d/gdm file:

#%PAM-1.0
auth sufficient pam_radius_auth.so
auth requisite pam_nologin.so
#auth sufficient pam_env.so readenv=1
#auth sufficient pam_env.so readenv=1 envfile=/etc/default/locale
auth sufficient pam_succeed_if.so
#auth sufficient pam_succeed_if.so user ingroup nopasswdlogin
@include common-auth
auth optional pam_gnome_keyring.so
account sufficient pam_radius_auth.so
@include common-account
#session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close
#session required pam_limits.so
session sufficient pam_mkhomedir.so skel=/home/formacio umask=0
@include common-session
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open
session optional pam_gnome_keyring.so auto_start
@include common-password


Thanks
 
Old 11-15-2011, 04:17 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Quote:
session sufficient pam_mkhomedir.so skel=/home/formacio umask=0
.. not sure why you'd set a umask of 0 .. anyway try changing it to optional instead of sufficient
 
1 members found this post helpful.
Old 11-16-2011, 03:02 AM   #3
Lorens
LQ Newbie
 
Registered: Oct 2011
Posts: 11

Original Poster
Rep: Reputation: Disabled
Thanks for your reply.

I'm setting umask=0022 (sorry my mistake).

I put it optional, but it's not working...


Only for the record, I'm using Ubuntu 10.04.3 and gnome 2.30.2

NOTE: If I create manually the home directories all is working well, but sadly I have to create the directories dynamically.

Last edited by Lorens; 11-16-2011 at 05:18 AM. Reason: Adding information
 
Old 11-16-2011, 04:50 PM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Try moving it to /etc/pam.d/system-auth or equivalent rather than /etc/pam.d/gdm
 
Old 11-17-2011, 02:44 AM   #5
Lorens
LQ Newbie
 
Registered: Oct 2011
Posts: 11

Original Poster
Rep: Reputation: Disabled
I tried putting it into common-auth and common-session with no success...
 
Old 11-17-2011, 05:00 AM   #6
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Ok, add 'debug' to the end of the line and we should see some info in /var/log/messages
 
Old 11-17-2011, 05:18 AM   #7
Lorens
LQ Newbie
 
Registered: Oct 2011
Posts: 11

Original Poster
Rep: Reputation: Disabled
I put the debug option but I don't see anything pam_mkhomedir.so related on /var/log/messages. I seems that pam_mkhomedir.so has no debug option.

Last edited by Lorens; 11-17-2011 at 05:30 AM.
 
Old 11-17-2011, 03:49 PM   #8
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Is your syslog configured to handle DEBUG level messages ?

The module is actually present .. ?

Last edited by kbp; 11-17-2011 at 03:57 PM.
 
Old 11-18-2011, 02:48 AM   #9
Lorens
LQ Newbie
 
Registered: Oct 2011
Posts: 11

Original Poster
Rep: Reputation: Disabled
I assume that syslog it's configured to output debug messages, because if I put the debug option on the pam_radius_auth.so lines I see the output.

Sorry, what do you mean with "the module is present"?
 
Old 11-18-2011, 03:02 AM   #10
Lorens
LQ Newbie
 
Registered: Oct 2011
Posts: 11

Original Poster
Rep: Reputation: Disabled
I'm posting the configuration files:

############# /etc/pam.d/common-account ####################

account sufficient pam_radius_auth.so
session required pam_mkhomedir.so

account [success=1 new_authtok_reqd=done default=ignore] pam_unix.so
account requisite pam_deny.so
account required pam_permit.so


############# /etc/pam.d/common-auth #######################

auth [success=1 default=ignore] pam_unix.so nullok_secure
auth requisite pam_deny.so
auth required pam_permit.so


############# /etc/pam.d/common-session #######################

session [default=1] pam_permit.so
session requisite pam_deny.so
session required pam_permit.so
session required pam_mkhomedir.so
session required pam_unix.so
session optional pam_ck_connector.so nox11


############# /etc/pam.d/gdm #######################

auth sufficient pam_radius_auth.so debug
auth requisite pam_nologin.so
auth sufficient pam_env.so readenv=1
auth sufficient pam_env.so readenv=1 envfile=/etc/default/locale
auth sufficient pam_succeed_if.so user ingroup nopasswdlogin
@include common-auth
auth optional pam_gnome_keyring.so
account sufficient pam_radius_auth.so
@include common-account
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close
session required pam_limits.so
session sufficient pam_mkhomedir.so skel=/home/formacio umask=0022
@include common-session
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open
session optional pam_gnome_keyring.so auto_start
@include common-password


############# /etc/pam.d/login #######################

auth required pam_securetty.so
auth requisite pam_nologin.so
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close
session required pam_env.so readenv=1
session required pam_env.so readenv=1 envfile=/etc/default/locale

# Standard Un*x authentication.
@include common-auth

auth optional pam_group.so

session required pam_limits.so
session optional pam_lastlog.so
session optional pam_motd.so
session optional pam_mail.so standard

# Standard Un*x account and session
@include common-account
@include common-session
@include common-password

session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open

############################################################

I hope this will help.
 
Old 11-19-2011, 01:53 AM   #11
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Try removing pam_mkhomedir lines from every file except common-session, and alter common-session as below:-

Code:
############# /etc/pam.d/common-session #######################

session [default=1] pam_permit.so
session requisite pam_deny.so
session required pam_permit.so
session optional pam_mkhomedir.so
session required pam_unix.so
session optional pam_ck_connector.so nox11
 
Old 11-22-2011, 07:00 AM   #12
Lorens
LQ Newbie
 
Registered: Oct 2011
Posts: 11

Original Poster
Rep: Reputation: Disabled
This way it's not working.

I already notice that the real problem is that accounting/session is failing because the radius user has not an entry at `/etc/passwd`

I'm currently trying to do adduser by `libpam_script.so` plugin. Maybe it's the solution
 
Old 11-29-2011, 04:12 AM   #13
Lorens
LQ Newbie
 
Registered: Oct 2011
Posts: 11

Original Poster
Rep: Reputation: Disabled
Finally I have solved the problem by using `pam_script` to execute `adduser` before entering the gdm session.

Thanks all.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! Adding user with a specific home directory that already exists dwoelper Linux - Newbie 7 04-09-2010 08:52 AM
Create user add file with default password and force user to change it? Morgandy Linux - Newbie 3 02-02-2010 05:06 PM
samba and pam.d create a home directory sal_paradise42 Linux - Networking 0 04-08-2009 05:51 PM
I can not open the user folder in home and write in a shared folder jorge_ivan Linux - General 8 08-02-2006 11:28 AM
Kmail Could not create folder $ /HOME/.mail dolphans1 Mandriva 2 01-19-2006 10:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 06:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration