Red Hat Bugzilla – Bug 67708
PAM can't unmount home directory following logout from 'su -' in special case
Last modified: 2007-04-18 12:43:47 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.5 (X11; Linux i686; U;) Gecko/0
Description of problem:
Please note that I discoverd this bug because I installed some non-Red Hat
supported tools. Though my example uses these tools to demonstrate the bug, I
still feel it is a bug that should be fixed.
I use the pam_mount PAM module to mount loopback encrypted home directories upon
logging in and unmount them upon logging out. This works fine except when I use
'su -'. In this case, the encrypted filesystem is mounted but cannot be
unmounted because su performs a chdir(~).
The chdir() call in su should happen after the fork() so that it does not affect
the parent PAM-controlling process.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Again, these steps use non-Red Hat supported tools, but I believe the bug is a
1. Apply the patch at http://www-2.cs.cmu.edu/~mukesh/hacks.html to pam_mount
2. Configure to pam_mount to mount a loopback encrypted filesystem for a user,
mike for example.
3. Log in as another user.
4. su - mike
5. <loopback encrypted filesystem is mounted>
Actual Results: Loopback encrypted filesystem is *not* unmounted because the su
process is chdir()ed to ~. umount says: /home/mike: device is busy.
Expected Results: Loopback encrypted filesystem should be unmounted.
Here is a small patch which fixes this bug:
--- su.c.orig Sun Jun 30 10:56:57 2002
+++ su.c Sun Jun 30 10:56:02 2002
@@ -509,6 +509,9 @@
+ if (chdir (pw->pw_dir))
+ error (0, errno, _("warning: cannot change directory to %s"),
shell_basename = base_name (shell);
arg0 = xmalloc (strlen (shell_basename) + 2);
arg0 = '-';
@@ -762,8 +765,6 @@
- if (simulate_login && chdir (pw->pw_dir))
- error (0, errno, _("warning: cannot change directory to %s"), pw->pw_dir);
run_shell (shell, command, additional_args, pw);
Fixed in 2.0.12-3