The other day I had the idea to create display manager independent guest session.

My basic idea was to change the login shell to a custom program that creates a temporary home on the fly (f.e. /tmp/guest-XXXXXX) and assign this session that home. After the user logs out it would remove that directory again. The problem I ran into is the following, I need to set a home in /etc/passwd and I can overwrite the HOME environment variable without a problem, but applications still seem to use the home set in passwd instead of the environment variable, at least in a graphical environment. I can not set the home in passwd because I do not know about it until the session has started.

The basic logic I came up with looks like this:

  • login shell started
  • temporary home created
  • HOME is set to this temporary home
  • a real shell is forked
  • after that real shell terminates, the temporary home is removed

This seems to work when I su into the user, but running a graphical session means that mot/all programs started use the home set in passwd.

Is it possible to change a user home on the fly/while a graphical session is active? DId I overlook something in the architecture of how the graphical sessions work?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.