[gdm-list] Fwd: Autologin and multiseat





Guy,
Thanks for the script. I have tuned it up a bit, you may be interested. 

My use case is a kiosk that creates a user based on the $DISPLAY and removes them when they log off. The password is a one time generated password.

First I had to revert to the fallback login box so I could remove the userlist.
mv /usr/share/gnome-session/sessions/gdm-shell.session /root/
cp /usr/share/gnome-session/sessions/gdm-fallback.session /usr/share/gnome-session/sessions/gdm-shell.session
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type bool --set "/apps/gdm/simple-greeter/disable_user_list" "true"

Then Copy /etc/gdm/Init/Default to :0

# cd /etc/gdm/Init
# cp Default :0

and add to the end of :0
/etc/gdm/Init/autologin.sh&


Link the number of displays required
ln :0 :1
ln :0 :2
...

Create the autologin.sh script 
vi /etc/gdm/Init/autologin.sh

#!/bin/bash
PASS=$(openssl rand -base64 32)
PW=$(perl -e 'print crypt("$PASS", "aa")')
exec >/var/log/gdm/${DISPLAY}-autolog.log 2>&1
LUSER=kiosk$(echo $DISPLAY | cut -c 2-)
if [ -d /home/$LUSER ]
then
# delete the user and home directory
/usr/sbin/userdel -f -r $LUSER
fi
/usr/sbin/useradd -m -k /home/admin -p $PW $LUSER
sleep 1
xdotool type $LUSER
xdotool key Return
sleep 1
xdotool type $PASS
xdotool key Return

Make it executable
# chmod +x autologin.sh

Fix Selinux file labels
# cd /etc/gdm/Init
# chcon --reference=Default :0 autologin.sh

Test by logging out of display, it should log back in automagically.

Thanks
Darryl


On Fri, Nov 23, 2012 at 5:59 PM, linux-service.be bvba <guy linux-service be> wrote:
sorry typo:
add at the bottom of  /etc/gdm/Init/:1
before exit 0:
 sh /usr/local/sbin/display1.sh username password  $

add at the bottom of  /etc/gdm/Init/:2
before exit 0:
 sh /usr/local/sbin/display2.sh username password  $



guy
> If you want 1 session per video-output on one card, gdm  2.20 is your only
> option. I pray that the gdm people will add again multiseat support to
> their gdm(or some kind of wrapper). It was one of the best feature in gdm.
> Now autlogin all users with gdm:
> Install xdotool of course.
> Copy the file /etc/gdm/Init/Default to /etc/gdm/Init/:1
> and /etc/gdm/Init/:2 and so on,according the amount of displays.
> Ceate a script /usr/local/sbin/display1.sh
> add to that file:
>
> #!/bin/sh
> sleep 3
> username=$1
> password=$2
> DISPLAY=:1
> export DISPLAY
> xhost +
> xdotool getactivewindow
> xdotool type "$username";
> sleep 1
> xdotool key KP_Enter
> sleep 1
> xdotool getactivewindow
> xdotool type "$password";
> sleep 1
> xdotool key KP_Enter
> xhost -
>
> and the next file for display 2:
> /usr/local/sbin/display2.sh
> #!/bin/sh
> sleep 3
> username=$1
> password=$2
> DISPLAY=:2
> export DISPLAY
> xhost +
> xdotool getactivewindow
> xdotool type "$username";
> sleep 1
> xdotool key KP_Enter
> sleep 1
> xdotool getactivewindow
> xdotool type "$password";
> sleep 1
> xdotool key KP_Enter
> xhost -
>
> add at the bootom of /etc/gdm/Init/Default to /etc/gdm/Init/:1
> before exit 0:
> sh /usr/local/sbin/display1.sh username password
> That is the user you want to login on the first screen
>
> same for /etc/gdm/Init/Default to /etc/gdm/Init/:2
> on the bottom before exit 0
> sh /usr/local/sbin/display2.sh username password
>
> If a user logs out, he will be logged in again.
>
> chmod +x all the new files you made.
>
> Reboot, enjoy.
>
> Guy
>
> > Guy,
> > Pity it is not supported anymore, but your suggestion for xdotool
> > certainly has merit. I have tried it for 2 minutes and confirmed that it
> > would do what I need.
> > I'd like to take you up on your offer for an example script?
> >
> > Thanks
> > Darryl
> >
> >
> > On Thu, Nov 22, 2012 at 10:12 PM, linux-service.be bvba <
> >
> > guy linux-service be> wrote:
> > > I don't think it's possible.
> > > There is a way with scripts and xdotool.
> > > Let me know if you want them.
> > >
> > > Guy
> > >
> > > > I want to set up a multiseat kiosk with autologin. I am using the new
> > > > systemd capabilities in Fedora 17 (gdm-3.4.1-3.fc17)
> > > > I cannot seem to get autologin or timed login to work on any display
> > >
> > > other
> > >
> > > > than the main console.
> > > >
> > > > I have a script that returns the account based on the $DISPLAY
> > > > variable. When I turn on debugging I see that the primary display
> > > > shows that the script was called but the other seat does not call it.
> > > >
> > > > The documentation indicates that I can use the $DISPLAY in my script
> > > > but how do I get the script to run for non-console displays?
> > > >
> > > > Thanks in advance
> > > > Darryl
> > >
> > > _______________________________________________
> > > gdm-list mailing list
> > > gdm-list gnome org
> > > https://mail.gnome.org/mailman/listinfo/gdm-list
>
> _______________________________________________
> gdm-list mailing list
> gdm-list gnome org
> https://mail.gnome.org/mailman/listinfo/gdm-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]