[debian-edu-commits] debian-edu/upstream/ 18/71: Report why the login is rejected using a PAM conversation message.
Petter Reinholdtsen
pere at moszumanska.debian.org
Mon Jun 9 18:25:36 UTC 2014
This is an automated email from the git hooks/post-receive script.
pere pushed a commit to branch master
in repository libpam-mklocaluser.
commit a176ce68fd5779fb9f5ac3dbc1555bf8c1d87cb7
Author: Petter Reinholdtsen <pere at hungry.com>
Date: Sat May 1 17:45:05 2010 +0000
Report why the login is rejected using a PAM conversation message.
---
debian/pam-python.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/debian/pam-python.py b/debian/pam-python.py
index 2133d1c..65b517a 100755
--- a/debian/pam-python.py
+++ b/debian/pam-python.py
@@ -27,6 +27,9 @@ def check_and_create_localuser(pamh, user):
# Create user entries with this shell
shell = '/bin/bash'
+ # File mode of new home directory
+ dirmode = 0700
+
# Fetch current user and group info, possibly from LDAP or NIS.
userinfo = pwd.getpwnam(user)
uid = userinfo[2]
@@ -47,7 +50,7 @@ def check_and_create_localuser(pamh, user):
newhomedir = os.path.join(topdir, user)
if not os.path.isdir(newhomedir):
- print "Creating local passwd entry uid=%d (%s) gid=%d(%s) gecos='%s' home=%s" % (uid, user, gid, groupname, gecos, newhomedir)
+# print "Creating local passwd entry uid=%d (%s) gid=%d(%s) gecos='%s' home=%s" % (uid, user, gid, groupname, gecos, newhomedir)
try:
# Add user entry with overridden home directory in /etc/passwd.
# Can not use adduser, as it refuses to add an existing user.
@@ -63,13 +66,18 @@ def check_and_create_localuser(pamh, user):
shutil.copytree("/etc/skel/.", newhomedir, True)
# Change perm of new home dir
- os.chmod(newhomedir,0700)
- # os.chown(newhomedir, uid, gid)
+ os.chmod(newhomedir, dirmode)
+ # os.chown(newhomedir, uid, gid) - not recursive
runcmd(pamh, "/bin/chown -R %d:%d '%s'" % (uid, gid, newhomedir))
# Flush nscd cache to get rid of original user entry
runcmd(pamh, "/usr/sbin/nscd -i passwd")
+ # Let the user know what is going on
+ msg = pamh.Message(pamh.PAM_TEXT_INFO,
+ "Local user created in /home/, please log in again to start using it.")
+ pamh.conversation(msg)
+
# Throw out user, as the log process cached the home directory
# and need to be restarted.
return pamh.PAM_TRY_AGAIN
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/upstream/libpam-mklocaluser.git
More information about the debian-edu-commits
mailing list