Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This is actually a 2 part question, one for design decisions, and the other a technical question:

In our current network, we have Linux clients that authenticate against a server, and mount the user's network home, but keeping the real home separate. The network home is mounted using pam_mount, and is unmounted on logout. However, the real home area remains, so our current approach is to clear /home on boot.

I have been looking into alternate methods of performing this, and an interesting way would be to mount a tmpfs 'disk' as the user's home area, then unmount it on logout. This would ideally be performed using pam_mount also. I have run into problems attempting to get this to work, which are detailed below.

Method 1

The 'original' clear /home on boot method, reliable, will generally always work, but might thrash the HDD/SSD due to many writes in the same areas. Current implementation is working fully.

Method 2

The 'new' tmpfs volatile home area, which is unmounted on logout. Advantages include automatic cleanup of home areas, fast reads/writes, and no disk reads/writes. Also gives easy limiting to size of home area. Disadvantages are potential running out of memory, but also several problems that I experienced:

On a heavily modified Ubuntu 12.04 system using XFCE, mounting the tmpfs through pam_mount worked fine, but unmounting failed with a Device is busy error. The problems don't stop there though, since even after logging out and working as root attempting to manually unmount the home area gave the same error, even though fuser and lsof showed nothing using that directory. In fact, I asked about this problem on askubuntu.com.

Attempting to do the same thing on a more standard Ubuntu 12.04 still failed using pam_mount to unmount, but manually unmounting worked fine this time. Doing exactly the same with my Arch system worked, even with pam_mount doing the unmounting.

Conclusion

So there are two methods to doing this. Are there any other pros/cons to each method, which might want to make me choose one over the other? And why won't the tmpfs home area thing work properly!

share|improve this question
    
Great idea! So no user can nohup(1) a process and leave, collecting output later. Presumably some uses of screen(1) are severely broken too. Please remind me never to get an account with you. –  vonbrand Feb 5 '13 at 13:16
    
This would be implemented on clients, which are not at all designed for use as you specify. But of course, this can also be taken into account in designing a different system that would accommodate such users. –  Xenopathic Feb 5 '13 at 13:25
    
I've seen setups where each user gets a freshly created virtual machine (or just freshly populated $HOME) on login. Sorry, no details at hand. –  vonbrand Feb 5 '13 at 13:30
    
why do you need the "original" homes, and what are they exactly? –  Isaac Feb 5 '13 at 14:34
    
Since these are machines designed for network-authenticated users to use (no non-system local users exist) any changes need to be reset to the machine defaults for each login. This lets us more easily control which settings are customizable, which are sent up to the server during logout (and are pulled down during login). –  Xenopathic Feb 5 '13 at 15:37

1 Answer 1

Try automount for your /home, which will do the network mount if a user logs in, and will unmount it when its no longer needed. You could do that for all users in /home, or define a seperate automount target for each user.

share|improve this answer
    
Isn't this what pam_mount was supposed to do? What would be the benefits of using autofs rather than pam_mount in this regard? –  Xenopathic Feb 6 '13 at 8:58

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.