Re: [gdm-list] PostLogin $HOME is not doing anything
- From: Brian Cameron <brian cameron oracle com>
- To: fuzzy sunshine <sunshine fuzzy gmail com>
- Cc: gdm-list gnome org
- Subject: Re: [gdm-list] PostLogin $HOME is not doing anything
- Date: Wed, 06 Apr 2011 04:57:50 -0500
Note that any environment variables set in the PreSession/PostSession
/PostLogin/Init scripts are not persistent. They only are set for the
time that the script runs. In other words, you cannot reset environment
variables like $HOME or $USER in these scripts.
If you want to setup the user's $HOME directory in a unique fashion,
I believe you need to use a custom PAM module that does this. The
following website is for solving a slightly different problem, but
shows the general technique:
http://danwalsh.livejournal.com/13376.html?thread=109120
On 04/ 6/11 12:54 AM, fuzzy sunshine wrote:
Hi there,
I'm trying to create a random directory, set the current sessions home
directory to it, copy the default profile to it and then make sure
proper ownership is set. I am trying to create a public terminal kiosk
where the autologin is the same via XDMCP. I have created a Default
script for PostLogin, which works except after it runs on Login the
session is still on the original home directory.
A quote from
http://library.gnome.org/admin/gdm/stable/configuration.html.en
After the user has been successfully authenticated GDM will run the
PostLogin script. This is done before any session setup has been
done, including before the pam_open_session call. This script is
useful for doing any session initialization that needs to happen
before the session starts. For example, you might setup the user's
$HOME directory if needed.
The PreSession/PostSession scripts can be useful for re-creating the
user's $HOME directory on each login. However, as I say above, you
cannot change the environment variables in these scripts.
Brian
So I created this:
#!/bin/bash
#
# Note: this is a sample and will not be run as is. Change the name of this
# file to <gdmconfdir>/PostLogin/Default for this script to be run. This
# script will be run before any setup is run on behalf of the user and is
# useful if you for example need to do some setup to create a home directory
# for the user or something like that. $HOME, $LOGIN and such will all be
# set appropriately and this script is run as root.
env > /tmp/aaa
if [ $USER == "google-chrome" ]
then
echo "Inside Loop" >> /tmp/aaa
export HOME=/home/google-chrome-`date +%N | md5sum | awk '{
print \$1; }'`
rsync -avz /home/google-chrome/* $HOME
chown -R google-chrome:google-chrome $HOME
env >> /tmp/aaa
fi
-----
Which I would have expected to have done what I needed but after this is
ran the login still reverts back to the original home directory. If I
use usermod -d $HOME google-chrome here as well I still end up with the
original home directory. Could someone please shed some light on how to
do this. I can figure out how to check for duplicates later and how to
remove stale ones at the end of the day, but I need to get the session
to listen to me first.
/tmp/aaa:
fuzzy@wifi-term:/etc/gdm3/PreSession$ cat /tmp/aaa
SHELL=/bin/bash
USER=google-chrome
X_SERVERS=/var/lib/gdm3/:12.Xservers
USERNAME=google-chrome
PATH=/usr/local/bin:/usr/bin:/bin:/usr/games
PWD=/var/lib/gdm3
GDM_PARENT_DISPLAY=:0
SHLVL=1
HOME=/home/google-chrome
GDM_PARENT_XAUTHORITY=/var/run/gdm3/auth-for-fuzzy-a8PRo9/database
LOGNAME=google-chrome
DISPLAY=:12
RUNNING_UNDER_GDM=true
XAUTHORITY=/var/run/gdm3/auth-for-Debian-gdm-nGxNR1/database
_=/usr/bin/env
Inside Loop
SHELL=/bin/bash
USER=google-chrome
X_SERVERS=/var/lib/gdm3/:12.Xservers
USERNAME=google-chrome
PATH=/usr/local/bin:/usr/bin:/bin:/usr/games
PWD=/var/lib/gdm3
GDM_PARENT_DISPLAY=:0
SHLVL=1
HOME=/home/google-chrome-60d0c68156f857b1a2e02f701bb029b2
GDM_PARENT_XAUTHORITY=/var/run/gdm3/auth-for-fuzzy-a8PRo9/database
LOGNAME=google-chrome
DISPLAY=:12
RUNNING_UNDER_GDM=true
XAUTHORITY=/var/run/gdm3/auth-for-Debian-gdm-nGxNR1/database
_=/usr/bin/env
_______________________________________________
gdm-list mailing list
gdm-list gnome org
http://mail.gnome.org/mailman/listinfo/gdm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]